Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 2_js / asStripClasses.js
1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "asStripeClasses" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         $('#example').dataTable( {
7                 "aaData": gaaData
8         } );
9         
10         oTest.fnTest( 
11                 "Default row striping is applied",
12                 null,
13                 function () {
14                         return $('#example tbody tr:eq(0)').hasClass('odd') &&
15                                $('#example tbody tr:eq(1)').hasClass('even') &&
16                                $('#example tbody tr:eq(2)').hasClass('odd') &&
17                                $('#example tbody tr:eq(3)').hasClass('even');
18                 }
19         );
20         
21         oTest.fnTest( 
22                 "Row striping on the second page",
23                 function () { $('#example_next').click(); },
24                 function () {
25                         return $('#example tbody tr:eq(0)').hasClass('odd') &&
26                                $('#example tbody tr:eq(1)').hasClass('even') &&
27                                $('#example tbody tr:eq(2)').hasClass('odd') &&
28                                $('#example tbody tr:eq(3)').hasClass('even');
29                 }
30         );
31         
32         /* No striping */
33         oTest.fnTest( 
34                 "No row striping",
35                 function () {
36                         oSession.fnRestore();
37                         $('#example').dataTable( {
38                                 "aaData": gaaData,
39                                 "asStripeClasses": []
40                         } );
41                 },
42                 function () {
43                         return $('#example tbody tr:eq(0)')[0].className == "" &&
44                                $('#example tbody tr:eq(1)')[0].className == "" &&
45                                $('#example tbody tr:eq(2)')[0].className == "" &&
46                                $('#example tbody tr:eq(3)')[0].className == "";
47                 }
48         );
49         
50         /* Custom striping */
51         oTest.fnTest( 
52                 "Custom striping [2]",
53                 function () {
54                         oSession.fnRestore();
55                         $('#example').dataTable( {
56                                 "aaData": gaaData,
57                                 "asStripeClasses": [ 'test1', 'test2' ]
58                         } );
59                 },
60                 function () {
61                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
62                                $('#example tbody tr:eq(1)').hasClass('test2') &&
63                                $('#example tbody tr:eq(2)').hasClass('test1') &&
64                                $('#example tbody tr:eq(3)').hasClass('test2');
65                 }
66         );
67         
68         
69         /* long array of striping */
70         oTest.fnTest( 
71                 "Custom striping [4]",
72                 function () {
73                         oSession.fnRestore();
74                         $('#example').dataTable( {
75                                 "aaData": gaaData,
76                                 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
77                         } );
78                 },
79                 function () {
80                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
81                                $('#example tbody tr:eq(1)').hasClass('test2') &&
82                                $('#example tbody tr:eq(2)').hasClass('test3') &&
83                                $('#example tbody tr:eq(3)').hasClass('test4');
84                 }
85         );
86         
87         oTest.fnTest( 
88                 "Custom striping is restarted on second page [2]",
89                 function () { $('#example_next').click(); },
90                 function () {
91                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
92                                $('#example tbody tr:eq(1)').hasClass('test2') &&
93                                $('#example tbody tr:eq(2)').hasClass('test3') &&
94                                $('#example tbody tr:eq(3)').hasClass('test4');
95                 }
96         );
97         
98         
99         oTest.fnComplete();
100 } );