X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F1_dom%2FfnInfoCallback.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F1_dom%2FfnInfoCallback.js;h=b4501d5fd028f5c538f0bf4caa0d23211d12b27d;hb=9bb6ee99ca7f738fac1087190b5481b8fe6e8d9f;hp=0000000000000000000000000000000000000000;hpb=2e3f6b76be585306f1003d849831840c0adb3360;p=proteocache.git diff --git a/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/fnInfoCallback.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/fnInfoCallback.js new file mode 100755 index 0000000..b4501d5 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/1_dom/fnInfoCallback.js @@ -0,0 +1,115 @@ +// DATA_TEMPLATE: dom_data +oTest.fnStart( "fnInfoCallback checks" ); + +$(document).ready( function () { + var mPass; + + $('#example').dataTable(); + + /* Basic checks */ + oTest.fnTest( + "null by default", + null, + function () { return $('#example').dataTable().fnSettings().oLanguage.fnInfoCallback == null; } + ); + + oTest.fnTest( + "Agrument length", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + mPass = arguments.length; + return sPre; + } + } ); + }, + function () { return mPass == 6; } + ); + + oTest.fnTest( + "Settings first", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + mPass = (oS == $('#example').dataTable().fnSettings()) ? true : false; + return sPre; + } + } ); + }, + function () { return mPass; } + ); + + oTest.fnTest( + "Start arg", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + return iStart; + } + } ); + }, + function () { return $('#example_info').html() == "1"; } + ); + + oTest.fnTest( + "End arg", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + return iEnd; + } + } ); + }, + function () { return $('#example_info').html() == "10"; } + ); + + oTest.fnTest( + "Max arg", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + return iMax; + } + } ); + }, + function () { return $('#example_info').html() == "57"; } + ); + + oTest.fnTest( + "Max arg - filter", + function () { + $('#example').dataTable().fnFilter("1.0"); + }, + function () { return $('#example_info').html() == "57"; } + ); + + oTest.fnTest( + "Total arg", + function () { + $('#example').dataTable( { + "bDestroy": true, + "fnInfoCallback": function( oS, iStart, iEnd, iMax, iTotal, sPre ) { + return iTotal; + } + } ); + }, + function () { return $('#example_info').html() == "57"; } + ); + + oTest.fnTest( + "Total arg - filter", + function () { + $('#example').dataTable().fnFilter("1.0"); + }, + function () { return $('#example_info').html() == "3"; } + ); + + + + oTest.fnComplete(); +} ); \ No newline at end of file