1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.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 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt" |
14 |
} ); |
15 |
var oSettings = oTable.fnSettings(); |
16 |
|
17 |
oTest.fnWaitTest( |
18 |
"Processing is off by default", |
19 |
null, |
20 |
function () { return oSettings.oFeatures.bProcessing == false; } |
21 |
); |
22 |
|
23 |
oTest.fnWaitTest( |
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.fnWaitTest( |
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.fnWaitTest( |
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.fnWaitTest( |
44 |
"Processing can be enabled", |
45 |
function () { |
46 |
oSession.fnRestore(); |
47 |
oTable = $('#example').dataTable( { |
48 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
49 |
"bProcessing": true |
50 |
} ); |
51 |
oSettings = oTable.fnSettings(); |
52 |
}, |
53 |
function () { return oSettings.oFeatures.bProcessing == true; } |
54 |
); |
55 |
|
56 |
oTest.fnWaitTest( |
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.fnWaitTest( |
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.fnWaitTest( |
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.fnWaitTest( |
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.fnWaitTest( |
82 |
"Processing disabled override", |
83 |
function () { |
84 |
oSession.fnRestore(); |
85 |
oTable = $('#example').dataTable( { |
86 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
87 |
"bProcessing": false |
88 |
} ); |
89 |
oSettings = oTable.fnSettings(); |
90 |
}, |
91 |
function () { return oSettings.oFeatures.bProcessing == false; } |
92 |
); |
93 |
|
94 |
oTest.fnWaitTest( |
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 |
} ); |