Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HeuristicLabWeb.PluginHost/HLWebPluginHost/Content/jQuery/jQueryPlugins/DataTables-1.7.6/media/unit_testing/tests_onhold/1_dom/aoColumns.iDataSort.js @ 6286

Last change on this file since 6286 was 6286, checked in by dkahn, 13 years ago

#1198 Added jQuery plus plugins

File size: 2.4 KB
RevLine 
[6286]1// DATA_TEMPLATE: dom_data
2oTest.fnStart( "aoColumns.iDataSort" );
3
4$(document).ready( function () {
5  /* Should know that sorting already works by default from other tests, so we can jump
6   * right in here
7   */
8  var oTable = $('#example').dataTable( {
9    "aoColumns": [
10      null,
11      { "iDataSort": 4 },
12      null,
13      null,
14      null
15    ]
16  } );
17  var oSettings = oTable.fnSettings();
18 
19  oTest.fnTest(
20    "Sorting on first column is uneffected",
21    null,
22    function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
23  );
24 
25  oTest.fnTest(
26    "Sorting on second column is the order of the fifth",
27    function () { $('#example thead th:eq(1)').click(); },
28    function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
29  );
30 
31  oTest.fnTest(
32    "Reserve sorting on second column uses fifth column as well",
33    function () { $('#example thead th:eq(1)').click(); },
34    function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
35  );
36 
37  oTest.fnTest(
38    "Sorting on 5th column retains it's own sorting",
39    function () { $('#example thead th:eq(4)').click(); },
40    function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
41  );
42 
43 
44  oTest.fnTest(
45    "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting",
46    function () {
47      mTmp = 0;
48      oSession.fnRestore();
49      oTable = $('#example').dataTable( {
50        "aoColumns": [
51          null,
52          { "iDataSort": 4 },
53          null,
54          null,
55          { "iDataSort": 1 }
56        ]
57      } );
58    },
59    function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; }
60  );
61 
62  oTest.fnTest(
63    "2nd col sorting uses fifth col",
64    function () { $('#example thead th:eq(1)').click(); },
65    function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }
66  );
67 
68  oTest.fnTest(
69    "2nd col sorting uses fifth col - reversed",
70    function () { $('#example thead th:eq(1)').click(); },
71    function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; }
72  );
73 
74  oTest.fnTest(
75    "5th col sorting uses 2nd col",
76    function () { $('#example thead th:eq(4)').click(); },
77    function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
78  );
79 
80  oTest.fnTest(
81    "5th col sorting uses 2nd col - reversed",
82    function () { $('#example thead th:eq(4)').click(); },
83    function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; }
84  );
85 
86 
87  oTest.fnComplete();
88} );
Note: See TracBrowser for help on using the repository browser.