Constructor
new module:ct-component /testing /Component Fixture(sXml, oModel Fixture, oView Fixtureopt)
Constructs a ComponentFixture
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
sXml |
String | the component XML required by the |
||
oModelFixture |
module:br-component |
the presentation model fixture. |
||
oViewFixture |
module:ct-dom |
<optional> |
{module:ct-dom/testing/ViewFixture} | the view fixture. |
- Implements:
Methods
add Sub Fixtures()
The ComponentFixture adds the following sub-fixtures:
-
model
: the presentation model fixture, for manipulating and verifying properties in the presentation model -
view
: the view fixture, the view fixture, for manipulating and verifying the state of elements on the component's view -
componentFrame
: the component frame fixture, for verifying the state of themodule:ct-component/frame/ComponentFrame
housing the component
add View Fixture Handlers(view Handlers Map)
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.
Parameters:
Name | Type | Description |
---|---|---|
viewHandlersMap |
Map | A map of handler name to handler class constructor reference |
can Handle Exact Match()
- See:
-
- module:br-test/Fixture#canHandleExactMatch
can Handle Property(sProperty)
ComponentFixture handles the 'opened' property.
Parameters:
Name | Type | Description |
---|---|---|
sProperty |
String | name of the property |
do Given(sProperty, 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.
Parameters:
Name | Type | Description |
---|---|---|
sProperty |
String | name of the property |
vValue |
String | value of the property |
- Implements:
- See:
do Then(sProperty, vValue)
doThen is not supported on the ComponentFixture.
Parameters:
Name | Type | Description |
---|---|---|
sProperty |
String | name of the property |
vValue |
String | value of the property |
- Implements:
- See:
do When(sProperty, vValue)
doWhen is not supported on the ComponentFixture.
Parameters:
Name | Type | Description |
---|---|---|
sProperty |
String | name of the property |
vValue |
String | value of the property |
- Implements:
- See:
get Component()
Returns the Component under test.
on Open(callback)
This method can be called to set a function on the fixture which will be executed whenever the component is created and opened.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | the function to execute on opening the component |
set Selector Mappings(selector Mappings)
Set the selector mappings to use with the view fixture. This method proxies the call to the
module:br-test/ViewFixture#setSelectorMappings
method.
Parameters:
Name | Type | Description |
---|---|---|
selectorMappings |
Object | Map of selector mappings. |
set Up()
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.
- Implements:
- See:
tear Down()
Upon tear-down of the ComponentFixture, the component created is closed and the ComponentFactory is re-configured to its original settings.
- Implements:
- See:
tear Down Old Component And Recreate With New XML(sXml)
Tear down this fixture and and recreate the component with the passed in xml string.
Parameters:
Name | Type | Description |
---|---|---|
sXml |
String | the xml string for the component. |