Caplin Trader 4.7.1

Class: module:caplin/menu/testing/MenuModelFixture

module:caplin/menu/testing/MenuModelFixture

Constructor

new module:caplin/menu/testing/MenuModelFixture()

Constructs a MenuModelFixture. The MenuModelFixture serves to create a context for testing the menu by interacting with a provided caplin.menu.model.Menu.

Tests may use the MenuModelFixture to:

  • Insert items: when("menuModel.addItemAt => 0")
  • Insert submenus: when("menuModel.addSubmenuAt => 1")
  • Remove items: when("menuModel.removeItemAt => 1")
    when("menuModel.removeAll => true")
  • Enable/Disable items: when("menuModel.disableItemAt => 1")
    when("menuModel.enableItemAt => 1")
  • Check whether a callback has been invoked on an item: then("menuModel.callbackInvokedOnItem = 1")
  • Check whether a callback has not been invoked on an item (needed when it is disabled): then("menuModel.callbackNotInvokedOnItem = 1")
Keep in mind that the model can be traversed by specifying an index instead of an action: when (menuModel.0.addItemAt => 1), will mean you want to add an item at position 1 on the submenu at position 0 (from the parent). You can use this with any of the above actions.
Implements:

Methods

canHandleProperty()

Implements:

doGiven()

Implements:

doThen()

Implements:

doWhen()

Implements:

tearDown()

Implements: