Sha256: f18d4f871f3670b8e566768966cbaec54d0ad8c066d0f2a6429520621bf7288d

Contents?: true

Size: 1.97 KB

Versions: 28

Compression:

Stored size: 1.97 KB

Contents

var giTotalTestCount = 0;
var giActiveModule = 0;
var giModuleTests;
var giStartTime;
var giTest;
var gbStop = false;
var gtoTest;

function fnTestStart ( sTestInfo )
{
	gaoTest[ giActiveModule ].iTests++;
	document.getElementById('test_info').innerHTML += 
		(giActiveModule+1)+'.'+(giModuleTests+1)+'. '+sTestInfo+'... ';
	document.getElementById('test_number').innerHTML = giTotalTestCount+1;
	giModuleTests++;
	giTotalTestCount++;
	
	/* Set a timer to catch stalled script */
	gtoTest = setTimeout( function () {
		fnMessage( '<span class="error">WARNING - test script stalled. Likely a JS error</span>' );
		gbStop = true;
	}, 3000 );
}

function fnTestResult ( bResult )
{
	clearTimeout( gtoTest );
	if ( bResult )
	{
		fnMessage( 'Passed' );
	}
	else
	{
		fnMessage( '<span class="error">FAILED</span>' );
		gbStop = true;
		fnEnd( false );
	}
}

function fnUnitStart( iTest )
{
	if ( !gbStop )
	{
		giModuleTests = 0;
		window.parent.test_arena.location.href = 
			(iTest==0?"":"../")+'templates/'+gaoTest[iTest].sTemplate+'.php?scripts='+gaoTest[iTest].sTest;
		giTest = iTest;
	}
}

function fnStartMessage( sMessage )
{
	fnMessage( '<br><b>'+gaoTest[giTest].sGroup+' - '+sMessage+'</b>' );
}

function fnMessage( sMessage )
{
	var nInfo = document.getElementById('test_info');
	nInfo.innerHTML += sMessage+'<br>';
	nInfo.scrollTop = nInfo.scrollHeight;
}

function fnUnitComplete()
{
	if ( giActiveModule < gaoTest.length - 1 )
	{
		fnUnitStart( ++giActiveModule );
	}
	else
	{
		fnEnd( true );
	}
}

function fnEnd( bSuccess )
{ 
	var iEndTime = new Date().getTime();
	var sTime = '<br>This test run took '+parseInt((iEndTime-giStartTime)/1000, 10)+
			' second(s) to complete.';
	
	if ( bSuccess )
	{
		$('#test_running').html( 'Tests complete. '+giTotalTestCount+' tests were run.'+sTime );
	}
	else
	{
		$('#test_running').html( 'Unit tests failed at test '+giTotalTestCount+'.'+sTime );
	}
}

$(document).ready( function () {
	giStartTime = new Date().getTime();
	fnUnitStart( giActiveModule );
} );

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
classiccms-0.7.5 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.7.4 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.7.3 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.7.2 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.7.1 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.7.0 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.9 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.8 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.7 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.6 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.5 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.4 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.3 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.2 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.1 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.6.0 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.5.17 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.5.16 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.5.15 lib/classiccms/public/admin/datatables/unit_testing/controller.js
classiccms-0.5.14 lib/classiccms/public/admin/datatables/unit_testing/controller.js