Class
caplin.menu.testing

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.

Constructor Summary

Attributes Name and Description
caplin.menu.testing.MenuModelFixture()

Constructs a caplin.menu.testing.MenuModelFixture.

Method Summary

Attributes Name and Description
void canHandleProperty( property)

See caplin.testing.Fixture#canHandleProperty

void doGiven( propertyName, value)

See caplin.testing.Fixture#doGiven

void doThen( propertyName, value)

See caplin.testing.Fixture#doThen

void doWhen( propertyName, value)

See caplin.testing.Fixture#doWhen

Methods implemented from class caplin.testing.Fixture:
addSubFixtures, setUp, tearDown

Constructor Detail

caplin.menu.testing.MenuModelFixture()

Constructs a caplin.menu.testing.MenuModelFixture.

Method Detail

void canHandleProperty( property)

See caplin.testing.Fixture#canHandleProperty

Parameters
property

void doGiven( propertyName, value)

See caplin.testing.Fixture#doGiven

Parameters
propertyName
value

void doThen( propertyName, value)

See caplin.testing.Fixture#doThen

Parameters
propertyName
value

void doWhen( propertyName, value)

See caplin.testing.Fixture#doWhen

Parameters
propertyName
value