1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "aoColumns.sClass" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
10 "By default the test class hasn't been applied to the column (sanity!)",
12 function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; }
16 "Add a class to a single column - first row",
19 $('#example').dataTable( {
23 { "sClass": 'unittest' },
29 function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); }
33 "Add a class to a single column - third row",
35 function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); }
39 "Add a class to a single column - last row",
41 function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); }
45 "Add a class to a single column - has not applied to other columns - 1st",
47 function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; }
51 "Add a class to a single column - has not applied to other columns - 5th",
53 function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; }
57 "Add a class to a single column - seventh row - second page",
58 function () { $('#example_next').click(); },
59 function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); }
63 "Add a class to a single column - has not applied to header",
65 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
69 "Add a class to a single column - has not applied to footer",
71 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
76 "Class defined for multiple columns - first row",
79 $('#example').dataTable( {
81 { "sClass": 'unittest2' },
84 { "sClass": 'unittest1' },
91 $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') &&
92 $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1');
98 "Class defined for multiple columns - has not applied to other columns - 5th 1",
100 function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; }
104 "Class defined for multiple columns - has not applied to other columns - 5th 2",
106 function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; }