2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
window.Class = easejs.Class;
|
|
|
|
window.Interface = easejs.Interface;
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
// namespace
|
|
|
|
window.rectest = { cases: {} };
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
$( document ).ready( function()
|
|
|
|
{
|
|
|
|
// display js-dependent content
|
|
|
|
$( '.hasjs' ).removeClass( 'hasjs' );
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
listCases( rectest.cases, $( '#case' ) );
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
displayNotice( 'Please configure the test using the form below.' );
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
$( '#continue' ).click( function()
|
2012-03-03 11:11:05 -05:00
|
|
|
{
|
2012-03-03 12:06:40 -05:00
|
|
|
var runner = rectest.TestRunner( jQuery, rectest.TestRun );
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
var options = {},
|
|
|
|
values = [
|
|
|
|
'case', 'set', 'interval', 'blank', 'samples', 'delay'
|
|
|
|
],
|
|
|
|
i = values.length;
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
while ( i-- )
|
2012-03-03 11:11:05 -05:00
|
|
|
{
|
2012-03-03 12:06:40 -05:00
|
|
|
var id = values[ i ];
|
|
|
|
options[ id ] = $( '#' + id ).val();
|
2012-03-03 11:11:05 -05:00
|
|
|
}
|
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
var testcase = rectest.cases[ options['case'] ].testCase();
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
$( this ).parent().hide();
|
2012-03-03 14:34:48 -05:00
|
|
|
hideNotice();
|
2012-03-03 16:16:19 -05:00
|
|
|
$( 'body' ).addClass( 'testing' );
|
2012-03-03 14:04:36 -05:00
|
|
|
|
|
|
|
runner.run( testcase, options, function( history )
|
|
|
|
{
|
2012-03-03 16:16:19 -05:00
|
|
|
$( 'body' ).removeClass( 'testing' );
|
|
|
|
|
2012-03-03 14:04:36 -05:00
|
|
|
console.log( history );
|
|
|
|
console.log( 'done' );
|
|
|
|
} );
|
2012-03-03 11:11:05 -05:00
|
|
|
} );
|
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
function displayNotice( str )
|
2012-03-03 11:11:05 -05:00
|
|
|
{
|
2012-03-03 12:06:40 -05:00
|
|
|
$( '.notice' )
|
|
|
|
.text( str )
|
2012-03-03 14:34:48 -05:00
|
|
|
.slideDown( 250, function()
|
|
|
|
{
|
|
|
|
$( this ).addClass( 'active' );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
function hideNotice()
|
|
|
|
{
|
|
|
|
$( '.notice' ).slideUp( 250, function()
|
|
|
|
{
|
|
|
|
$( this ).removeClass( 'active' );
|
|
|
|
} );
|
2012-03-03 12:06:40 -05:00
|
|
|
}
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
function listCases( presets, $select )
|
|
|
|
{
|
|
|
|
for ( var preset in presets )
|
2012-03-03 11:11:05 -05:00
|
|
|
{
|
2012-03-03 12:06:40 -05:00
|
|
|
var data = presets[ preset ];
|
2012-03-03 11:11:05 -05:00
|
|
|
|
2012-03-03 12:06:40 -05:00
|
|
|
$select.append( $( '<option>' )
|
|
|
|
.attr( 'value', preset )
|
|
|
|
.text( data.title )
|
|
|
|
);
|
2012-03-03 11:11:05 -05:00
|
|
|
}
|
2012-03-03 12:06:40 -05:00
|
|
|
}
|
|
|
|
} );
|