X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F2_js%2FasStripClasses.js;fp=webapp%2Fresources%2Fdatatables-1.9.4%2Fmedia%2Funit_testing%2Ftests_onhold%2F2_js%2FasStripClasses.js;h=fa3af8272eb6c156719fa6e337439474dfb69df6;hb=9bb6ee99ca7f738fac1087190b5481b8fe6e8d9f;hp=0000000000000000000000000000000000000000;hpb=2e3f6b76be585306f1003d849831840c0adb3360;p=proteocache.git diff --git a/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/2_js/asStripClasses.js b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/2_js/asStripClasses.js new file mode 100644 index 0000000..fa3af82 --- /dev/null +++ b/webapp/resources/datatables-1.9.4/media/unit_testing/tests_onhold/2_js/asStripClasses.js @@ -0,0 +1,100 @@ +// DATA_TEMPLATE: js_data +oTest.fnStart( "asStripeClasses" ); + +$(document).ready( function () { + /* Check the default */ + $('#example').dataTable( { + "aaData": gaaData + } ); + + oTest.fnTest( + "Default row striping is applied", + null, + function () { + return $('#example tbody tr:eq(0)').hasClass('odd') && + $('#example tbody tr:eq(1)').hasClass('even') && + $('#example tbody tr:eq(2)').hasClass('odd') && + $('#example tbody tr:eq(3)').hasClass('even'); + } + ); + + oTest.fnTest( + "Row striping on the second page", + function () { $('#example_next').click(); }, + function () { + return $('#example tbody tr:eq(0)').hasClass('odd') && + $('#example tbody tr:eq(1)').hasClass('even') && + $('#example tbody tr:eq(2)').hasClass('odd') && + $('#example tbody tr:eq(3)').hasClass('even'); + } + ); + + /* No striping */ + oTest.fnTest( + "No row striping", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aaData": gaaData, + "asStripeClasses": [] + } ); + }, + function () { + return $('#example tbody tr:eq(0)')[0].className == "" && + $('#example tbody tr:eq(1)')[0].className == "" && + $('#example tbody tr:eq(2)')[0].className == "" && + $('#example tbody tr:eq(3)')[0].className == ""; + } + ); + + /* Custom striping */ + oTest.fnTest( + "Custom striping [2]", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aaData": gaaData, + "asStripeClasses": [ 'test1', 'test2' ] + } ); + }, + function () { + return $('#example tbody tr:eq(0)').hasClass('test1') && + $('#example tbody tr:eq(1)').hasClass('test2') && + $('#example tbody tr:eq(2)').hasClass('test1') && + $('#example tbody tr:eq(3)').hasClass('test2'); + } + ); + + + /* long array of striping */ + oTest.fnTest( + "Custom striping [4]", + function () { + oSession.fnRestore(); + $('#example').dataTable( { + "aaData": gaaData, + "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ] + } ); + }, + function () { + return $('#example tbody tr:eq(0)').hasClass('test1') && + $('#example tbody tr:eq(1)').hasClass('test2') && + $('#example tbody tr:eq(2)').hasClass('test3') && + $('#example tbody tr:eq(3)').hasClass('test4'); + } + ); + + oTest.fnTest( + "Custom striping is restarted on second page [2]", + function () { $('#example_next').click(); }, + function () { + return $('#example tbody tr:eq(0)').hasClass('test1') && + $('#example tbody tr:eq(1)').hasClass('test2') && + $('#example tbody tr:eq(2)').hasClass('test3') && + $('#example tbody tr:eq(3)').hasClass('test4'); + } + ); + + + oTest.fnComplete(); +} ); \ No newline at end of file