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

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/2_js/aoColumns.bSortable.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: 2663 byte(s)
initial import
1 // DATA_TEMPLATE: js_data
2 oTest.fnStart( "aoColumns.bSortable" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
7 "aaData": gaaData
8 } );
9 var oSettings = oTable.fnSettings();
10
11 oTest.fnTest(
12 "All columns are sortable by default",
13 function () { $('#example thead th:eq(1)').click(); },
14 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; }
15 );
16
17 oTest.fnTest(
18 "Can disable sorting from one column",
19 function () {
20 oSession.fnRestore();
21 $('#example').dataTable( {
22 "aaData": gaaData,
23 "aoColumns": [
24 null,
25 { "bSortable": false },
26 null,
27 null,
28 null
29 ]
30 } );
31 $('#example thead th:eq(1)').click();
32 },
33 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; }
34 );
35
36 oTest.fnTest(
37 "Disabled column has no sorting class",
38 null,
39 function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; }
40 );
41
42 oTest.fnTest(
43 "Other columns can still sort",
44 function () {
45 $('#example thead th:eq(4)').click();
46 $('#example thead th:eq(4)').click();
47 },
48 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; }
49 );
50
51 oTest.fnTest(
52 "Disable sorting on multiple columns - no sorting classes",
53 function () {
54 oSession.fnRestore();
55 $('#example').dataTable( {
56 "aaData": gaaData,
57 "aoColumns": [
58 null,
59 { "bSortable": false },
60 null,
61 { "bSortable": false },
62 null
63 ]
64 } );
65 },
66 function () {
67 var bReturn =
68 $('#example thead th:eq(1)').hasClass("sorting") ||
69 $('#example thead th:eq(3)').hasClass("sorting")
70 return bReturn == false;
71 }
72 );
73
74 oTest.fnTest(
75 "Sorting on disabled column 1 has no effect",
76 function () {
77 $('#example thead th:eq(1)').click();
78 },
79 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; }
80 );
81
82 oTest.fnTest(
83 "Sorting on disabled column 2 has no effect",
84 function () {
85 $('#example thead th:eq(3)').click();
86 },
87 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; }
88 );
89
90 oTest.fnTest(
91 "Second sort on disabled column 2 has no effect",
92 function () {
93 $('#example thead th:eq(3)').click();
94 },
95 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; }
96 );
97
98 oTest.fnTest(
99 "Even with multiple disabled sorting columns other columns can still sort",
100 function () {
101 $('#example thead th:eq(4)').click();
102 $('#example thead th:eq(4)').click();
103 },
104 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; }
105 );
106
107
108 oTest.fnComplete();
109 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20