/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/3_ajax/aoSearchCols.js
ViewVC logotype

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

  ViewVC Help
Powered by ViewVC 1.1.20