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

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/bSortClasses.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: 3847 byte(s)
initial import
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "bSortClasses" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable();
7
8 oTest.fnTest(
9 "Sorting classes are applied by default",
10 null,
11 function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); }
12 );
13
14 oTest.fnTest(
15 "Sorting classes are applied to all required cells",
16 null,
17 function () { return $('#example tbody tr:eq(7) td:eq(0)').hasClass('sorting_1'); }
18 );
19
20 oTest.fnTest(
21 "Sorting classes are not applied to non-sorting columns",
22 null,
23 function () { return $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_1') == false; }
24 );
25
26 oTest.fnTest(
27 "Sorting multi-column - add column 1",
28 function () {
29 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); },
30 function () {
31 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') &&
32 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2');
33 }
34 );
35
36 oTest.fnTest(
37 "Sorting multi-column - add column 2",
38 function () {
39 oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); },
40 function () {
41 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') &&
42 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') &&
43 $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3');
44 }
45 );
46
47 oTest.fnTest(
48 "Sorting multi-column - add column 3",
49 function () {
50 oDispacher.click( $('#example thead th:eq(3)')[0], { 'shift': true } );
51 },
52 function () {
53 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') &&
54 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') &&
55 $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') &&
56 $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3');
57 }
58 );
59
60 oTest.fnTest(
61 "Remove sorting classes on single column sort",
62 function () {
63 $('#example thead th:eq(4)').click();
64 },
65 function () {
66 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false &&
67 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false &&
68 $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false &&
69 $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3') == false;
70 }
71 );
72
73 oTest.fnTest(
74 "Sorting class 1 was added",
75 null,
76 function () { return $('#example tbody tr:eq(1) td:eq(4)').hasClass('sorting_1'); }
77 );
78
79
80 /* Check can disable */
81 oTest.fnTest(
82 "Sorting classes can be disabled",
83 function () {
84 oSession.fnRestore();
85 $('#example').dataTable( {
86 "bSortClasses": false
87 } );
88 },
89 function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false; }
90 );
91
92 oTest.fnTest(
93 "Sorting classes disabled - add column 1 - no effect",
94 function () {
95 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); },
96 function () {
97 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false &&
98 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false;
99 }
100 );
101
102 oTest.fnTest(
103 "Sorting classes disabled - add column 2 - no effect",
104 function () {
105 oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); },
106 function () {
107 return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false &&
108 $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false &&
109 $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false;
110 }
111 );
112
113
114 /* Enable makes no difference */
115 oTest.fnTest(
116 "Sorting classes enabled override",
117 function () {
118 oSession.fnRestore();
119 $('#example').dataTable( {
120 "bSortClasses": true
121 } );
122 },
123 function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); }
124 );
125
126
127 oTest.fnComplete();
128 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20