Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 1_dom / aoColumns.sClass.js
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "aoColumns.sClass" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         var oTable = $('#example').dataTable();
7         var oSettings = oTable.fnSettings();
8         
9         oTest.fnTest( 
10                 "By default the test class hasn't been applied to the column (sanity!)",
11                 null,
12                 function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; }
13         );
14         
15         oTest.fnTest( 
16                 "Add a class to a single column - first row",
17                 function () {
18                         oSession.fnRestore();
19                         $('#example').dataTable( {
20                                 "aoColumns": [
21                                         null,
22                                         null,
23                                         { "sClass": 'unittest' },
24                                         null,
25                                         null
26                                 ]
27                         } );
28                 },
29                 function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); }
30         );
31         
32         oTest.fnTest( 
33                 "Add a class to a single column - third row",
34                 null,
35                 function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); }
36         );
37         
38         oTest.fnTest( 
39                 "Add a class to a single column - last row",
40                 null,
41                 function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); }
42         );
43         
44         oTest.fnTest( 
45                 "Add a class to a single column - has not applied to other columns - 1st",
46                 null,
47                 function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; }
48         );
49         
50         oTest.fnTest( 
51                 "Add a class to a single column - has not applied to other columns - 5th",
52                 null,
53                 function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; }
54         );
55         
56         oTest.fnTest( 
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'); }
60         );
61         
62         oTest.fnTest( 
63                 "Add a class to a single column - has not applied to header",
64                 null,
65                 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
66         );
67         
68         oTest.fnTest( 
69                 "Add a class to a single column - has not applied to footer",
70                 null,
71                 function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; }
72         );
73         
74         
75         oTest.fnTest( 
76                 "Class defined for multiple columns - first row",
77                 function () {
78                         oSession.fnRestore();
79                         $('#example').dataTable( {
80                                 "aoColumns": [
81                                         { "sClass": 'unittest2' },
82                                         null,
83                                         null,
84                                         { "sClass": 'unittest1' },
85                                         null
86                                 ]
87                         } );
88                 },
89                 function () {
90                         var bReturn = 
91                                 $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') &&
92                                 $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1');
93                         return bReturn;
94                 }
95         );
96         
97         oTest.fnTest( 
98                 "Class defined for multiple columns - has not applied to other columns - 5th 1",
99                 null,
100                 function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; }
101         );
102         
103         oTest.fnTest( 
104                 "Class defined for multiple columns - has not applied to other columns - 5th 2",
105                 null,
106                 function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; }
107         );
108         
109         
110         oTest.fnComplete();
111 } );