annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/oLanguage.sZeroRecords.js @ 9:7300ed4c1481 draft default tip

Uploaded
author saskia-hiltemann
date Mon, 04 Sep 2017 10:49:00 -0400
parents ac5f9272033b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 // DATA_TEMPLATE: empty_table
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 oTest.fnStart( "oLanguage.sZeroRecords" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 $(document).ready( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 /* Check the default */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 "bDeferRender": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 var oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 "Zero records language is 'No matching records found' by default",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 "Text is shown when empty table (after filtering)",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 function () { oTable.fnFilter('nothinghere'); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 "Zero records language can be defined",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 "oLanguage": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 "sZeroRecords": "unit test"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 function () { return oSettings.oLanguage.sZeroRecords == "unit test"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 "Text is shown when empty table (after filtering)",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 function () { oTable.fnFilter('nothinghere2'); },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 function () { return $('#example tbody tr td')[0].innerHTML == "unit test" }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 } );