Mercurial > repos > saskia-hiltemann > ireport
comparison DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/asStripClasses.js @ 0:ac5f9272033b draft
first upload
author | saskia-hiltemann |
---|---|
date | Tue, 01 Jul 2014 11:42:23 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ac5f9272033b |
---|---|
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 "bDeferRender": true | |
9 } ); | |
10 | |
11 oTest.fnWaitTest( | |
12 "Default row striping is applied", | |
13 null, | |
14 function () { | |
15 return $('#example tbody tr:eq(0)').hasClass('odd') && | |
16 $('#example tbody tr:eq(1)').hasClass('even') && | |
17 $('#example tbody tr:eq(2)').hasClass('odd') && | |
18 $('#example tbody tr:eq(3)').hasClass('even'); | |
19 } | |
20 ); | |
21 | |
22 oTest.fnWaitTest( | |
23 "Row striping on the second page", | |
24 function () { $('#example_next').click(); }, | |
25 function () { | |
26 return $('#example tbody tr:eq(0)').hasClass('odd') && | |
27 $('#example tbody tr:eq(1)').hasClass('even') && | |
28 $('#example tbody tr:eq(2)').hasClass('odd') && | |
29 $('#example tbody tr:eq(3)').hasClass('even'); | |
30 } | |
31 ); | |
32 | |
33 /* No striping */ | |
34 oTest.fnWaitTest( | |
35 "No row striping", | |
36 function () { | |
37 oSession.fnRestore(); | |
38 $('#example').dataTable( { | |
39 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", | |
40 "bDeferRender": true, | |
41 "asStripeClasses": [] | |
42 } ); | |
43 }, | |
44 function () { | |
45 if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' ) | |
46 { | |
47 /* Use the 'wait for' to allow this to become true */ | |
48 return false; | |
49 } | |
50 return $('#example tbody tr:eq(0)')[0].className == "" && | |
51 $('#example tbody tr:eq(1)')[0].className == "" && | |
52 $('#example tbody tr:eq(2)')[0].className == "" && | |
53 $('#example tbody tr:eq(3)')[0].className == ""; | |
54 } | |
55 ); | |
56 | |
57 /* Custom striping */ | |
58 oTest.fnWaitTest( | |
59 "Custom striping [2]", | |
60 function () { | |
61 oSession.fnRestore(); | |
62 $('#example').dataTable( { | |
63 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", | |
64 "bDeferRender": true, | |
65 "asStripeClasses": [ 'test1', 'test2' ] | |
66 } ); | |
67 }, | |
68 function () { | |
69 return $('#example tbody tr:eq(0)').hasClass('test1') && | |
70 $('#example tbody tr:eq(1)').hasClass('test2') && | |
71 $('#example tbody tr:eq(2)').hasClass('test1') && | |
72 $('#example tbody tr:eq(3)').hasClass('test2'); | |
73 } | |
74 ); | |
75 | |
76 | |
77 /* long array of striping */ | |
78 oTest.fnWaitTest( | |
79 "Custom striping [4]", | |
80 function () { | |
81 oSession.fnRestore(); | |
82 $('#example').dataTable( { | |
83 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", | |
84 "bDeferRender": true, | |
85 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ] | |
86 } ); | |
87 }, | |
88 function () { | |
89 return $('#example tbody tr:eq(0)').hasClass('test1') && | |
90 $('#example tbody tr:eq(1)').hasClass('test2') && | |
91 $('#example tbody tr:eq(2)').hasClass('test3') && | |
92 $('#example tbody tr:eq(3)').hasClass('test4'); | |
93 } | |
94 ); | |
95 | |
96 oTest.fnWaitTest( | |
97 "Custom striping is restarted on second page [2]", | |
98 function () { $('#example_next').click(); }, | |
99 function () { | |
100 return $('#example tbody tr:eq(0)').hasClass('test1') && | |
101 $('#example tbody tr:eq(1)').hasClass('test2') && | |
102 $('#example tbody tr:eq(2)').hasClass('test3') && | |
103 $('#example tbody tr:eq(3)').hasClass('test4'); | |
104 } | |
105 ); | |
106 | |
107 | |
108 oTest.fnComplete(); | |
109 } ); |