/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/asStripClasses.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/asStripClasses.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 2975 byte(s)
initial import
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "asStripeClasses" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable();
7
8 oTest.fnTest(
9 "Default row striping is applied",
10 null,
11 function () {
12 return $('#example tbody tr:eq(0)').hasClass('odd') &&
13 $('#example tbody tr:eq(1)').hasClass('even') &&
14 $('#example tbody tr:eq(2)').hasClass('odd') &&
15 $('#example tbody tr:eq(3)').hasClass('even');
16 }
17 );
18
19 oTest.fnTest(
20 "Row striping does not effect current classes",
21 null,
22 function () {
23 return $('#example tbody tr:eq(0)').hasClass('gradeA') &&
24 $('#example tbody tr:eq(1)').hasClass('gradeA') &&
25 $('#example tbody tr:eq(2)').hasClass('gradeA') &&
26 $('#example tbody tr:eq(3)').hasClass('gradeA');
27 }
28 );
29
30 oTest.fnTest(
31 "Row striping on the second page",
32 function () { $('#example_next').click(); },
33 function () {
34 return $('#example tbody tr:eq(0)').hasClass('odd') &&
35 $('#example tbody tr:eq(1)').hasClass('even') &&
36 $('#example tbody tr:eq(2)').hasClass('odd') &&
37 $('#example tbody tr:eq(3)').hasClass('even');
38 }
39 );
40
41 /* No striping */
42 oTest.fnTest(
43 "No row striping",
44 function () {
45 oSession.fnRestore();
46 $('#example').dataTable( {
47 "asStripeClasses": []
48 } );
49 },
50 function () {
51 return $('#example tbody tr:eq(0)')[0].className == "gradeA" &&
52 $('#example tbody tr:eq(1)')[0].className == "gradeA" &&
53 $('#example tbody tr:eq(2)')[0].className == "gradeA" &&
54 $('#example tbody tr:eq(3)')[0].className == "gradeA";
55 }
56 );
57
58 /* Custom striping */
59 oTest.fnTest(
60 "Custom striping [2]",
61 function () {
62 oSession.fnRestore();
63 $('#example').dataTable( {
64 "asStripeClasses": [ 'test1', 'test2' ]
65 } );
66 },
67 function () {
68 return $('#example tbody tr:eq(0)').hasClass('test1') &&
69 $('#example tbody tr:eq(1)').hasClass('test2') &&
70 $('#example tbody tr:eq(2)').hasClass('test1') &&
71 $('#example tbody tr:eq(3)').hasClass('test2');
72 }
73 );
74
75
76 /* long array of striping */
77 oTest.fnTest(
78 "Custom striping [4]",
79 function () {
80 oSession.fnRestore();
81 $('#example').dataTable( {
82 "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ]
83 } );
84 },
85 function () {
86 return $('#example tbody tr:eq(0)').hasClass('test1') &&
87 $('#example tbody tr:eq(1)').hasClass('test2') &&
88 $('#example tbody tr:eq(2)').hasClass('test3') &&
89 $('#example tbody tr:eq(3)').hasClass('test4');
90 }
91 );
92
93 oTest.fnTest(
94 "Custom striping is restarted on second page [2]",
95 function () { $('#example_next').click(); },
96 function () {
97 return $('#example tbody tr:eq(0)').hasClass('test1') &&
98 $('#example tbody tr:eq(1)').hasClass('test2') &&
99 $('#example tbody tr:eq(2)').hasClass('test3') &&
100 $('#example tbody tr:eq(3)').hasClass('test4');
101 }
102 );
103
104
105 oTest.fnComplete();
106 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20