Attributes | Name and Description |
---|---|
|
caplin.component.testing.ComponentFixture(String sXml, caplin.component.testing.ComponentModelFixture oModelFixture, caplin.dom.testing.ViewFixture oViewFixture)
Constructs a |
Attributes | Name and Description |
---|---|
|
void
addSubFixtures( oFixtureRegistry)
The ComponentFixture adds the following sub-fixtures:
|
|
void
addViewFixtureHandlers(Map viewHandlersMap)
Allows custom view handlers to be added. |
|
void
canHandleExactMatch()
|
|
boolean
canHandleProperty(String sProperty)
ComponentFixture handles the 'opened' property. |
|
void
doGiven(String sProperty, String vValue)
This method creates and opens the component created, and sets it on the presentation model and view sub-fixtures so that tests may manipulate model properties and the view elements. |
|
void
doThen(String sProperty, String vValue)
doThen is not supported on the ComponentFixture. |
|
void
doWhen(String sProperty, String vValue)
doWhen is not supported on the ComponentFixture. |
|
void
getComponent()
Returns the Component under test. |
|
void
onOpen(function fCallback)
This method can be called to set a function on the fixture which will be executed whenever the component is created and opened. |
|
void
setUp()
Upon set-up of the ComponentFixture, the ComponentFactory is configured not to create an ErrorComponent. |
|
void
tearDown()
Upon tear-down of the ComponentFixture, the component created is closed and the ComponentFactory is re-configured to its original settings. |
|
void
tearDownOldComponentAndRecreateWithNewXML(String sXml)
Tear down this fixture and and recreate the component with the passed in xml string. |
►
caplin.component.testing.ComponentFixture(String sXml, caplin.component.testing.ComponentModelFixture oModelFixture, caplin.dom.testing.ViewFixture oViewFixture)
Constructs a caplin.component.testing.ComponentFixture
.
String | sXml | the component XML required by the {@link caplin.component.ComponentFactory ComponentFactory} to create the component. Required. |
caplin.component.testing.ComponentModelFixture | oModelFixture | the presentation model fixture. Required. |
caplin.dom.testing.ViewFixture | oViewFixture | the view fixture. Optional.
The ComponentFixture serves to create components using the ComponentFactory when these are required in
the system under test.
In addition to creating and opening the component, the ComponentFixture defines several sub-fixtures to be added to the test runner, enabling the testing and manipulation of the view and presentation model of the component. |
►
void
addSubFixtures( oFixtureRegistry)
The ComponentFixture adds the following sub-fixtures:
model
: the presentation model fixture, for manipulating and verifying properties in the presentation modelview
: the view fixture, the view fixture, for manipulating and verifying the state of elements on the component's viewcomponentFrame
: the component frame fixture, for verifying the state of the caplin.component.frame.ComponentFrame housing the componentoFixtureRegistry |
►
void
addViewFixtureHandlers(Map viewHandlersMap)
Allows custom view handlers to be added. The ViewFixture's addViewHandlers method throws an exception if an attempt is made to override an existing handler.
Map | viewHandlersMap | A map of handler name to handler class constructor reference |
►
void
canHandleExactMatch()
►
boolean
canHandleProperty(String sProperty)
ComponentFixture handles the 'opened' property.
String | sProperty | name of the property |
►
void
doGiven(String sProperty, String vValue)
This method creates and opens the component created, and sets it on the presentation model and view sub-fixtures so that tests may manipulate model properties and the view elements.
String | sProperty | name of the property |
String | vValue | value of the property |
►
void
doThen(String sProperty, String vValue)
doThen is not supported on the ComponentFixture.
String | sProperty | name of the property |
String | vValue | value of the property |
►
void
doWhen(String sProperty, String vValue)
doWhen is not supported on the ComponentFixture.
String | sProperty | name of the property |
String | vValue | value of the property |
►
void
getComponent()
Returns the Component under test.
►
void
onOpen(function fCallback)
This method can be called to set a function on the fixture which will be executed whenever the component is created and opened.
function | fCallback | the function to execute on opening the component |
►
void
setUp()
Upon set-up of the ComponentFixture, the ComponentFactory is configured not to create an ErrorComponent. If no component can be created with the given XML configuration, an exception will be thrown instead.
►
void
tearDown()
Upon tear-down of the ComponentFixture, the component created is closed and the ComponentFactory is re-configured to its original settings.
►
void
tearDownOldComponentAndRecreateWithNewXML(String sXml)
Tear down this fixture and and recreate the component with the passed in xml string.
String | sXml | the xml string for the component. |