annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/oLanguage.sSearch.js @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
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.sSearch" );
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 "Search language is 'Search:' 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.sSearch == "Search:"; }
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.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 "A label input is used",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 function () { return $('label', oSettings.aanFeatures.f[0]).length == 1 }
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 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 "Search language default is in the DOM",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 function () { return $('label', oSettings.aanFeatures.f[0]).text()
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 == "Search: "; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 "Search language can be defined",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 "oLanguage": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 "sSearch": "unit test"
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 function () { return oSettings.oLanguage.sSearch == "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 oTest.fnTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 "Info language definition is in the DOM",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 function () { return $('label', oSettings.aanFeatures.f[0]).text().indexOf('unit test') !== -1; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 "Blank search has a no space (separator) inserted",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 "oLanguage": {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 "sSearch": ""
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 function () { return document.getElementById('example_filter').childNodes.length == 1; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 } );