/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/5_ajax_objects/bProcessing.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/5_ajax_objects/bProcessing.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: 3914 byte(s)
initial import
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/objects.txt",
14 "aoColumns": [
15 { "mData": "engine" },
16 { "mData": "browser" },
17 { "mData": "platform" },
18 { "mData": "version" },
19 { "mData": "grade" }
20 ]
21 } );
22 var oSettings = oTable.fnSettings();
23
24 oTest.fnWaitTest(
25 "Processing is off by default",
26 null,
27 function () { return oSettings.oFeatures.bProcessing == false; }
28 );
29
30 oTest.fnWaitTest(
31 "Processing div is not in the DOM",
32 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
33 function () { return document.getElementById('example_processing') == null; }
34 );
35
36 oTest.fnWaitTest(
37 "Processing div cannot be shown",
38 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
39 function () { return document.getElementById('example_processing') == null; }
40 );
41
42 oTest.fnWaitTest(
43 "Processing div cannot be hidden",
44 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
45 function () { return document.getElementById('example_processing') == null; }
46 );
47
48
49 /* Check can disable */
50 oTest.fnWaitTest(
51 "Processing can be enabled",
52 function () {
53 oSession.fnRestore();
54 oTable = $('#example').dataTable( {
55 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
56 "aoColumnDefs": [
57 { "mData": "engine", "aTargets": [0] },
58 { "mData": "browser", "aTargets": [1] },
59 { "mData": "platform", "aTargets": [2] },
60 { "mData": "version", "aTargets": [3] },
61 { "mData": "grade", "aTargets": [4] }
62 ],
63 "bProcessing": true
64 } );
65 oSettings = oTable.fnSettings();
66 },
67 function () { return oSettings.oFeatures.bProcessing == true; }
68 );
69
70 oTest.fnWaitTest(
71 "Processing div is in the DOM",
72 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
73 function () { return document.getElementById('example_processing'); }
74 );
75
76 oTest.fnWaitTest(
77 "Processing div is hidden by default",
78 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
79 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
80 );
81
82 oTest.fnWaitTest(
83 "Processing div can be shown",
84 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
85 function () { return document.getElementById('example_processing').style.visibility = "visible"; }
86 );
87
88 oTest.fnWaitTest(
89 "Processing div can be hidden",
90 function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); },
91 function () { return document.getElementById('example_processing').style.visibility = "hidden"; }
92 );
93
94 /* Enable makes no difference */
95 oTest.fnWaitTest(
96 "Processing disabled override",
97 function () {
98 oSession.fnRestore();
99 oTable = $('#example').dataTable( {
100 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
101 "aoColumnDefs": [
102 { "mData": "engine", "aTargets": [0] },
103 { "mData": "browser", "aTargets": [1] },
104 { "mData": "platform", "aTargets": [2] },
105 { "mData": "version", "aTargets": [3] },
106 { "mData": "grade", "aTargets": [4] }
107 ],
108 "bProcessing": false
109 } );
110 oSettings = oTable.fnSettings();
111 },
112 function () { return oSettings.oFeatures.bProcessing == false; }
113 );
114
115 oTest.fnWaitTest(
116 "Processing div is not in the DOM",
117 function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); },
118 function () { return document.getElementById('example_processing') == null; }
119 );
120
121
122
123 oTest.fnComplete();
124 } );

  ViewVC Help
Powered by ViewVC 1.1.20