Testing
Front-end testing of your UI Wires using a beautiful test API.
component extends="cbwire.models.BaseWireTest" {
function run(){
describe( "TaskList.cfc", function(){
it( "calling 'clearTasks' removes the tasks", function() {
wire( "TaskList" )
// Sets our data properties
.data( "tasks", [ "task1" ] )
// Verifies output in our template rendering
.see( "<li>task 1</li>" )
// Runs the 'clearTasks' action
.call( "clearTasks" )
// Verifies updated template rendering
.dontSee( "<li>task 1</li>" );
} );
} );
}
}
wire( "TaskList" )
.data( "tasks", [ "task1", "task2" ] ) // one property at a time
.data( { "tasks" : [ "task1", "task2" ] } ); // struct of properties
wire( "TaskList" )
.computed( "count", function() { return 3; } ) // one property at a time
.computed( { "count" : function() { return 3; } } ); // struct of properties
wire( "TaskList" ).toggle( "showModal" );
wire( "TaskList" ).call( "clearTasks" );
wire( "TaskList" ).call( "clearTasks", [ param1, param2 ] );
wire( "TaskList" ).emit( "addedTask" );
wire( "TaskList" ).emit( "addedTask", [ param1, param2 ] );
wire( "TaskList" ).see( "<h1>My Tasks</h1>" );
wire( "TaskList" ).dontSee( "<h1>Someone Else's Tasks</h1> ");
wire( "TaskList" ).seeData( "tasksRemoved", true );
wire( "TaskList" ).dontSeeData( "tasksRemoved", true );
Last modified 2mo ago