Add datatables-1.9.4 and jquery-1.10.2 libraries
[proteocache.git] / webapp / resources / datatables-1.9.4 / media / unit_testing / tests_onhold / 3_ajax / asStripClasses.js
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "asStripeClasses" );
3
4 $(document).ready( function () {
5         /* Check the default */
6         $('#example').dataTable( {
7                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt"
8         } );
9         
10         oTest.fnWaitTest( 
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.fnWaitTest( 
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.fnWaitTest( 
34                 "No row striping",
35                 function () {
36                         oSession.fnRestore();
37                         $('#example').dataTable( {
38                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
39                                 "asStripeClasses": []
40                         } );
41                 },
42                 function () {
43                         if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' )
44                         {
45                                 /* Use the 'wait for' to allow this to become true */
46                                 return false;
47                         }
48                         return $('#example tbody tr:eq(0)')[0].className == "" &&
49                                $('#example tbody tr:eq(1)')[0].className == "" &&
50                                $('#example tbody tr:eq(2)')[0].className == "" &&
51                                $('#example tbody tr:eq(3)')[0].className == "";
52                 }
53         );
54         
55         /* Custom striping */
56         oTest.fnWaitTest( 
57                 "Custom striping [2]",
58                 function () {
59                         oSession.fnRestore();
60                         $('#example').dataTable( {
61                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
62                                 "asStripeClasses": [ 'test1', 'test2' ]
63                         } );
64                 },
65                 function () {
66                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
67                                $('#example tbody tr:eq(1)').hasClass('test2') &&
68                                $('#example tbody tr:eq(2)').hasClass('test1') &&
69                                $('#example tbody tr:eq(3)').hasClass('test2');
70                 }
71         );
72         
73         
74         /* long array of striping */
75         oTest.fnWaitTest( 
76                 "Custom striping [4]",
77                 function () {
78                         oSession.fnRestore();
79                         $('#example').dataTable( {
80                                 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
81                                 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
82                         } );
83                 },
84                 function () {
85                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
86                                $('#example tbody tr:eq(1)').hasClass('test2') &&
87                                $('#example tbody tr:eq(2)').hasClass('test3') &&
88                                $('#example tbody tr:eq(3)').hasClass('test4');
89                 }
90         );
91         
92         oTest.fnWaitTest( 
93                 "Custom striping is restarted on second page [2]",
94                 function () { $('#example_next').click(); },
95                 function () {
96                         return $('#example tbody tr:eq(0)').hasClass('test1') &&
97                                $('#example tbody tr:eq(1)').hasClass('test2') &&
98                                $('#example tbody tr:eq(2)').hasClass('test3') &&
99                                $('#example tbody tr:eq(3)').hasClass('test4');
100                 }
101         );
102         
103         
104         oTest.fnComplete();
105 } );