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

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/5_ajax_objects/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, 2 months ago) by torben
File MIME type: application/javascript
File size: 3280 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "bSort" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
8 "aoColumns": [
9 { "mData": "engine" },
10 { "mData": "browser" },
11 { "mData": "platform" },
12 { "mData": "version" },
13 { "mData": "grade" }
14 ]
15 } );
16
17 oTest.fnWaitTest(
18 "Sorting is on by default",
19 null,
20 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
21 );
22
23 oTest.fnWaitTest(
24 "Sorting Asc by default class applied",
25 null,
26 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); }
27 );
28
29 oTest.fnWaitTest(
30 "Click on second column",
31 function () { $('#example thead th:eq(1)').click(); },
32 function () { return $('#example tbody td:eq(1)').html() == "All others"; }
33 );
34
35 oTest.fnWaitTest(
36 "Sorting class removed from first column",
37 null,
38 function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; }
39 );
40
41 oTest.fnWaitTest(
42 "Sorting asc class applied to second column",
43 null,
44 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); }
45 );
46
47 oTest.fnWaitTest(
48 "Reverse on second column",
49 function () { $('#example thead th:eq(1)').click(); },
50 function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; }
51 );
52
53 oTest.fnWaitTest(
54 "Sorting acs class removed from second column",
55 null,
56 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; }
57 );
58
59 oTest.fnWaitTest(
60 "Sorting desc class applied to second column",
61 null,
62 function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); }
63 );
64
65 /* Check can disable */
66 oTest.fnWaitTest(
67 "Pagiantion can be disabled",
68 function () {
69 oSession.fnRestore();
70 $('#example').dataTable( {
71 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
72 "aoColumnDefs": [
73 { "mData": "engine", "aTargets": [0] },
74 { "mData": "browser", "aTargets": [1] },
75 { "mData": "platform", "aTargets": [2] },
76 { "mData": "version", "aTargets": [3] },
77 { "mData": "grade", "aTargets": [4] }
78 ],
79 "bSort": false
80 } );
81 },
82 function () { return $('#example tbody td:eq(3)').html() == "4"; }
83 );
84
85 oTest.fnWaitTest(
86 "Click on second column has no effect",
87 function () { $('#example thead th:eq(1)').click(); },
88 function () { return $('#example tbody td:eq(3)').html() == "4"; }
89 );
90
91 oTest.fnWaitTest(
92 "Reverse on second column has no effect",
93 function () { $('#example thead th:eq(1)').click(); },
94 function () { return $('#example tbody td:eq(3)').html() == "4"; }
95 );
96
97 /* Enable makes no difference */
98 oTest.fnWaitTest(
99 "Sorting enabled override",
100 function () {
101 oSession.fnRestore();
102 $('#example').dataTable( {
103 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
104 "aoColumnDefs": [
105 { "mData": "engine", "aTargets": [0] },
106 { "mData": "browser", "aTargets": [1] },
107 { "mData": "platform", "aTargets": [2] },
108 { "mData": "version", "aTargets": [3] },
109 { "mData": "grade", "aTargets": [4] }
110 ],
111 "bSort": true
112 } );
113 },
114 function () { return $('#example tbody td:eq(0)').html() == "Gecko"; }
115 );
116
117
118
119 oTest.fnComplete();
120 } );

  ViewVC Help
Powered by ViewVC 1.1.20