annotate DataTables-1.9.4/media/unit_testing/tests_onhold/6_delayed_rendering/aoSearchCols.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( "aoSearchCols" );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 /* We could be here forever testing this one, so we test a limited subset on a couple of colums */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 $(document).ready( function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 /* Check the default */
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 var oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 "bDeferRender": true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 var oSettings = oTable.fnSettings();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 "Default should be to have a empty colums array",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 var bReturn =
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex &&
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 return bReturn;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 "Search on a single column - no regex statement given",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 "aoSearchCols": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 { "sSearch": "Mozilla" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 { "sSearch": "1" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; }
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.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 "Search on two columns - no regex statement given",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 "aoSearchCols": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 { "sSearch": "Mozilla" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 { "sSearch": "1.5" },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 "Search on single column - escape regex false",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 "aoSearchCols": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 { "sSearch": ".*ML", "bEscapeRegex": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83 function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 "Search on two columns - escape regex false on first, true on second",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93 "aoSearchCols": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 { "sSearch": ".*ML", "bEscapeRegex": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 { "sSearch": "3.3", "bEscapeRegex": true },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 oTest.fnWaitTest(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 "Search on two columns (no records) - escape regex false on first, true on second",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 function () {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 oSession.fnRestore();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 oTable = $('#example').dataTable( {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 "bDeferRender": true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 "aoSearchCols": [
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 { "sSearch": ".*ML", "bEscapeRegex": false },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 { "sSearch": "Allan", "bEscapeRegex": true },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 null,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 null
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119 } );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 oTest.fnComplete();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 } );