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/2_js/aoColumns.bVisible.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.5 KB
Line 
1// DATA_TEMPLATE: js_data
2oTest.fnStart( "aoColumns.bVisible" );
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 visible by default",
13    null,
14    function () { return $('#example tbody tr:eq(0) td').length == 5; }
15  );
16 
17  oTest.fnTest(
18    "Can hide one column and it removes td column from DOM",
19    function () {
20      oSession.fnRestore();
21      $('#example').dataTable( {
22        "aaData": gaaData,
23        "aoColumns": [
24          null,
25          { "bVisible": false },
26          null,
27          null,
28          null
29        ]
30      } );
31    },
32    function () { return $('#example tbody tr:eq(0) td').length == 4; }
33  );
34 
35  oTest.fnTest(
36    "Can hide one column and it removes thead th column from DOM",
37    null,
38    function () { return $('#example thead tr:eq(0) th').length == 4; }
39  );
40 
41  oTest.fnTest(
42    "Can hide one column and it removes tfoot th column from DOM",
43    null,
44    function () { return $('#example tfoot tr:eq(0) th').length == 4; }
45  );
46 
47  oTest.fnTest(
48    "The correct tbody column has been hidden",
49    function () {
50      oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
51    },
52    function () {
53      var jqNodes = $('#example tbody tr:eq(0) td');
54      var bReturn =
55        jqNodes[0].innerHTML == "Gecko" &&
56        jqNodes[1].innerHTML == "Gnome" &&
57        jqNodes[2].innerHTML == "1.8" &&
58        jqNodes[3].innerHTML == "A";
59      return bReturn;
60    }
61  );
62 
63 
64  oTest.fnTest(
65    "Can hide multiple columns and it removes td column from DOM",
66    function () {
67      oSession.fnRestore();
68      $('#example').dataTable( {
69        "aaData": gaaData,
70        "aoColumns": [
71          null,
72          { "bVisible": false },
73          { "bVisible": false },
74          null,
75          { "bVisible": false }
76        ]
77      } );
78    },
79    function () { return $('#example tbody tr:eq(0) td').length == 2; }
80  );
81 
82  oTest.fnTest(
83    "Multiple hide - removes thead th column from DOM",
84    null,
85    function () { return $('#example thead tr:eq(0) th').length == 2; }
86  );
87 
88  oTest.fnTest(
89    "Multiple hide - removes tfoot th column from DOM",
90    null,
91    function () { return $('#example tfoot tr:eq(0) th').length == 2; }
92  );
93 
94  oTest.fnTest(
95    "Multiple hide - the correct tbody columns have been hidden",
96    function () {
97      oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
98    },
99    function () {
100      var jqNodes = $('#example tbody tr:eq(0) td');
101      var bReturn =
102        jqNodes[0].innerHTML == "Gecko" &&
103        jqNodes[1].innerHTML == "1"
104      return bReturn;
105    }
106  );
107 
108 
109  oTest.fnComplete();
110} );
Note: See TracBrowser for help on using the repository browser.