/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/2_js/bSort.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/2_js/bSort.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: 2436 byte(s)
initial import
1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "bSort" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
7 "aaData": gaaData
8 } );
9
10 oTest.fnTest(
11 "Sorting is on by default",
12 null,
13 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
14 );
15
16 oTest.fnTest(
17 "Sorting Asc by default class applied",
18 null,
19 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); }
20 );
21
22 oTest.fnTest(
23 "Click on second column",
24 function () { $('#example thead th:eq(1)').click(); },
25 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
26 );
27
28 oTest.fnTest(
29 "Sorting class removed from first column",
30 null,
31 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; }
32 );
33
34 oTest.fnTest(
35 "Sorting asc class applied to second column",
36 null,
37 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); }
38 );
39
40 oTest.fnTest(
41 "Reverse on second column",
42 function () { $('#example thead th:eq(1)').click(); },
43 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
44 );
45
46 oTest.fnTest(
47 "Sorting acs class removed from second column",
48 null,
49 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; }
50 );
51
52 oTest.fnTest(
53 "Sorting desc class applied to second column",
54 null,
55 function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); }
56 );
57
58 /* Check can disable */
59 oTest.fnTest(
60 "Pagiantion can be disabled",
61 function () {
62 oSession.fnRestore();
63 $('#example').dataTable( {
64 "aaData": gaaData,
65 "bSort": false
66 } );
67 },
68 function () { return $('#example tbody td:eq(3)').html() == "4"; }
69 );
70
71 oTest.fnTest(
72 "Click on second column has no effect",
73 function () { $('#example thead th:eq(1)').click(); },
74 function () { return $('#example tbody td:eq(3)').html() == "4"; }
75 );
76
77 oTest.fnTest(
78 "Reverse on second column has no effect",
79 function () { $('#example thead th:eq(1)').click(); },
80 function () { return $('#example tbody td:eq(3)').html() == "4"; }
81 );
82
83 /* Enable makes no difference */
84 oTest.fnTest(
85 "Sorting enabled override",
86 function () {
87 oSession.fnRestore();
88 $('#example').dataTable( {
89 "aaData": gaaData,
90 "bSort": true
91 } );
92 },
93 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
94 );
95
96
97
98 oTest.fnComplete();
99 } );

  ViewVC Help
Powered by ViewVC 1.1.20