1 | // DATA_TEMPLATE: empty_table |
---|
2 | oTest.fnStart( "oLanguage.sLengthMenu" ); |
---|
3 | |
---|
4 | $(document).ready( function () { |
---|
5 | /* Check the default */ |
---|
6 | var oTable = $('#example').dataTable( { |
---|
7 | "bServerSide": true, |
---|
8 | "sAjaxSource": "../../../examples/examples_support/server_processing.php" |
---|
9 | } ); |
---|
10 | var oSettings = oTable.fnSettings(); |
---|
11 | |
---|
12 | oTest.fnWaitTest( |
---|
13 | "Menu language is 'Show _MENU_ entries' by default", |
---|
14 | null, |
---|
15 | function () { return oSettings.oLanguage.sLengthMenu == "Show _MENU_ entries"; } |
---|
16 | ); |
---|
17 | |
---|
18 | oTest.fnTest( |
---|
19 | "_MENU_ macro is replaced by select menu in DOM", |
---|
20 | null, |
---|
21 | function () { return $('select', oSettings.aanFeatures.l[0]).length == 1 } |
---|
22 | ); |
---|
23 | |
---|
24 | oTest.fnTest( |
---|
25 | "Default is put into DOM", |
---|
26 | null, |
---|
27 | function () { |
---|
28 | var anChildren = oSettings.aanFeatures.l[0].childNodes; |
---|
29 | var bReturn = |
---|
30 | anChildren[0].nodeValue == "Show " && |
---|
31 | anChildren[2].nodeValue == " entries"; |
---|
32 | return bReturn; |
---|
33 | } |
---|
34 | ); |
---|
35 | |
---|
36 | |
---|
37 | oTest.fnWaitTest( |
---|
38 | "Menu length language can be defined - no _MENU_ macro", |
---|
39 | function () { |
---|
40 | oSession.fnRestore(); |
---|
41 | oTable = $('#example').dataTable( { |
---|
42 | "bServerSide": true, |
---|
43 | "sAjaxSource": "../../../examples/examples_support/server_processing.php", |
---|
44 | "oLanguage": { |
---|
45 | "sLengthMenu": "unit test" |
---|
46 | } |
---|
47 | } ); |
---|
48 | oSettings = oTable.fnSettings(); |
---|
49 | }, |
---|
50 | function () { return oSettings.oLanguage.sLengthMenu == "unit test"; } |
---|
51 | ); |
---|
52 | |
---|
53 | oTest.fnTest( |
---|
54 | "Menu length language definition is in the DOM", |
---|
55 | null, |
---|
56 | function () { |
---|
57 | var anChildren = oSettings.aanFeatures.l[0].childNodes; |
---|
58 | return anChildren[0].nodeValue == "unit test"; |
---|
59 | } |
---|
60 | ); |
---|
61 | |
---|
62 | |
---|
63 | oTest.fnWaitTest( |
---|
64 | "Menu length language can be defined - with _MENU_ macro", |
---|
65 | function () { |
---|
66 | oSession.fnRestore(); |
---|
67 | oTable = $('#example').dataTable( { |
---|
68 | "bServerSide": true, |
---|
69 | "sAjaxSource": "../../../examples/examples_support/server_processing.php", |
---|
70 | "oLanguage": { |
---|
71 | "sLengthMenu": "unit _MENU_ test" |
---|
72 | } |
---|
73 | } ); |
---|
74 | oSettings = oTable.fnSettings(); |
---|
75 | }, |
---|
76 | function () { |
---|
77 | var anChildren = oSettings.aanFeatures.l[0].childNodes; |
---|
78 | var bReturn = |
---|
79 | anChildren[0].nodeValue == "unit " && |
---|
80 | anChildren[2].nodeValue == " test"; |
---|
81 | return bReturn; |
---|
82 | } |
---|
83 | ); |
---|
84 | |
---|
85 | |
---|
86 | oTest.fnWaitTest( |
---|
87 | "Only the _MENU_ macro", |
---|
88 | function () { |
---|
89 | oSession.fnRestore(); |
---|
90 | oTable = $('#example').dataTable( { |
---|
91 | "bServerSide": true, |
---|
92 | "sAjaxSource": "../../../examples/examples_support/server_processing.php", |
---|
93 | "oLanguage": { |
---|
94 | "sLengthMenu": "_MENU_" |
---|
95 | } |
---|
96 | } ); |
---|
97 | oSettings = oTable.fnSettings(); |
---|
98 | }, |
---|
99 | function () { |
---|
100 | var anChildren = oSettings.aanFeatures.l[0].childNodes; |
---|
101 | var bReturn = |
---|
102 | anChildren.length == 1 && |
---|
103 | $('select', oSettings.aanFeatures.l[0]).length == 1; |
---|
104 | return bReturn; |
---|
105 | } |
---|
106 | ); |
---|
107 | |
---|
108 | |
---|
109 | oTest.fnComplete(); |
---|
110 | } ); |
---|