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/bProcessing.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: 3.0 KB
RevLine 
[6286]1// DATA_TEMPLATE: js_data
2oTest.fnStart( "bProcessing" );
3
4/* It's actually a bit hard to set this one due to the fact that it will only be shown
5 * when DataTables is doing some kind of processing. The server-side processing is a bit
6 * better to test this than here - so we just the interal functions to enable it and check
7 * that it is available
8 */
9
10$(document).ready( function () {
11  /* Check the default */
12  var oTable = $('#example').dataTable( {
13    "aaData": gaaData
14  } );
15  var oSettings = oTable.fnSettings();
16 
17  oTest.fnTest(
18    "Processing is off by default",
19    null,
20    function () { return oSettings.oFeatures.bProcessing == false; }
21  );
22 
23  oTest.fnTest(
24    "Processing div is not in the DOM",
25    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
26    function () { return document.getElementById('example_processing') == null; }
27  );
28 
29  oTest.fnTest(
30    "Processing div cannot be shown",
31    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
32    function () { return document.getElementById('example_processing') == null; }
33  );
34 
35  oTest.fnTest(
36    "Processing div cannot be hidden",
37    function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
38    function () { return document.getElementById('example_processing') == null; }
39  );
40 
41 
42  /* Check can disable */
43  oTest.fnTest(
44    "Processing can be enabled",
45    function () {
46      oSession.fnRestore();
47      oTable = $('#example').dataTable( {
48        "aaData": gaaData,
49        "bProcessing": true
50      } );
51      oSettings = oTable.fnSettings();
52    },
53    function () { return oSettings.oFeatures.bProcessing == true; }
54  );
55 
56  oTest.fnTest(
57    "Processing div is in the DOM",
58    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
59    function () { return document.getElementById('example_processing'); }
60  );
61 
62  oTest.fnTest(
63    "Processing div is hidden by default",
64    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
65    function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
66  );
67 
68  oTest.fnTest(
69    "Processing div can be shown",
70    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
71    function () { return document.getElementById('example_processing').style.visibility = "visible"; }
72  );
73 
74  oTest.fnTest(
75    "Processing div can be hidden",
76    function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
77    function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
78  );
79 
80  /* Enable makes no difference */
81  oTest.fnTest(
82    "Processing disabled override",
83    function () {
84      oSession.fnRestore();
85      oTable = $('#example').dataTable( {
86        "aaData": gaaData,
87        "bProcessing": false
88      } );
89      oSettings = oTable.fnSettings();
90    },
91    function () { return oSettings.oFeatures.bProcessing == false; }
92  );
93 
94  oTest.fnTest(
95    "Processing div is not in the DOM",
96    function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
97    function () { return document.getElementById('example_processing') == null; }
98  );
99 
100 
101 
102  oTest.fnComplete();
103} );
Note: See TracBrowser for help on using the repository browser.