annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 // DATA_TEMPLATE: empty_table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 oTest.fnStart( "asStripeClasses" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 $(document).ready( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 /* Check the default */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 "bDeferRender": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 "Default row striping is applied",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 return $('#example tbody tr:eq(0)').hasClass('odd') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 $('#example tbody tr:eq(1)').hasClass('even') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 $('#example tbody tr:eq(2)').hasClass('odd') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 $('#example tbody tr:eq(3)').hasClass('even');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 "Row striping on the second page",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 function () { $('#example_next').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 return $('#example tbody tr:eq(0)').hasClass('odd') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 $('#example tbody tr:eq(1)').hasClass('even') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 $('#example tbody tr:eq(2)').hasClass('odd') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 $('#example tbody tr:eq(3)').hasClass('even');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 /* No striping */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 "No row striping",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 "asStripeClasses": []
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' )
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 /* Use the 'wait for' to allow this to become true */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 return false;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 return $('#example tbody tr:eq(0)')[0].className == "" &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 $('#example tbody tr:eq(1)')[0].className == "" &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 $('#example tbody tr:eq(2)')[0].className == "" &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 $('#example tbody tr:eq(3)')[0].className == "";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 /* Custom striping */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 "Custom striping [2]",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 "asStripeClasses": [ 'test1', 'test2' ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 return $('#example tbody tr:eq(0)').hasClass('test1') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 $('#example tbody tr:eq(1)').hasClass('test2') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 $('#example tbody tr:eq(2)').hasClass('test1') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 $('#example tbody tr:eq(3)').hasClass('test2');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 /* long array of striping */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 "Custom striping [4]",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 return $('#example tbody tr:eq(0)').hasClass('test1') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 $('#example tbody tr:eq(1)').hasClass('test2') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 $('#example tbody tr:eq(2)').hasClass('test3') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 $('#example tbody tr:eq(3)').hasClass('test4');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 "Custom striping is restarted on second page [2]",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 function () { $('#example_next').click(); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 return $('#example tbody tr:eq(0)').hasClass('test1') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 $('#example tbody tr:eq(1)').hasClass('test2') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 $('#example tbody tr:eq(2)').hasClass('test3') &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 $('#example tbody tr:eq(3)').hasClass('test4');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 } );