Class
caplin.presenter.testing

PresenterComponentFixture

The PresenterComponentFixture serves to create presenter components in order to test the component behavior.

Tests may use the PresenterComponentFixture to:

  • create a presenter component to test the model behavior:
    given("component.opened = true")
    and(component presentation model is in state A)
    when(component presentation model is modified)
    then(component presentation model is in new state B)
  • create a presenter component and bind it (using knockout) to the view template, to test the model and view behavior:
    given("component.viewOpened = true")
    and(component presentation model is in state A)
    and(component view is in state X)
    when(button clicked on component view)
    then(component presentation model is in new state B)
    and(component view is in new state Y)

Constructor Summary

Attributes Name and Description
caplin.presenter.testing.PresenterComponentFixture(String sTemplateId, String sPresentationModel)

Constructs a caplin.presenter.testing.PresenterComponentFixture.

Method Summary

Attributes Name and Description
void canHandleProperty(String sProperty)

PresenterComponentFixture handles properties 'opened' and 'viewOpened'.

void doGiven(String sProperty, Variant vValue)

This method creates the presenter component (if property = 'opened') and binds it to the view template (if property = 'viewOpened') using the references to the template Id and presentation model provided in the constructor.

Methods inherited from class caplin.component.testing.ComponentFixture:
addSubFixtures, addViewFixtureHandlers, canHandleExactMatch, doThen, doWhen, getComponent, onOpen, setUp, tearDown, tearDownOldComponentAndRecreateWithNewXML

Constructor Detail

caplin.presenter.testing.PresenterComponentFixture(String sTemplateId, String sPresentationModel)

Constructs a caplin.presenter.testing.PresenterComponentFixture.

Parameters
String sTemplateId the HTML template id representing the view of the presenter component. Required, not-null.
String sPresentationModel the presentation model class name for the presenter component. Required, not-null.

Method Detail

void canHandleProperty(String sProperty)

PresenterComponentFixture handles properties 'opened' and 'viewOpened'.

Parameters
String sProperty The property to check.
See
caplin.testing.Fixture#canHandleProperty

void doGiven(String sProperty, Variant vValue)

This method creates the presenter component (if property = 'opened') and binds it to the view template (if property = 'viewOpened') using the references to the template Id and presentation model provided in the constructor.

Parameters
String sProperty The property name
Variant vValue The value to check.
See
caplin.testing.Fixture#doGiven