1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "oLanguage.sLengthMenu" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
10 "Menu language is 'Show _MENU_ entries' by default",
12 function () { return oSettings.oLanguage.sLengthMenu == "Show _MENU_ entries"; }
16 "_MENU_ macro is replaced by select menu in DOM",
18 function () { return $('select', oSettings.aanFeatures.l[0]).length == 1 }
22 "A label input is used",
24 function () { return $('label', oSettings.aanFeatures.l[0]).length == 1 }
28 "Default is put into DOM",
31 var anChildren = $('label',oSettings.aanFeatures.l[0])[0].childNodes;
33 anChildren[0].nodeValue == "Show " &&
34 anChildren[2].nodeValue == " entries";
41 "Menu length language can be defined - no _MENU_ macro",
44 oTable = $('#example').dataTable( {
46 "sLengthMenu": "unit test"
49 oSettings = oTable.fnSettings();
51 function () { return oSettings.oLanguage.sLengthMenu == "unit test"; }
55 "Menu length language definition is in the DOM",
58 return $('label', oSettings.aanFeatures.l[0]).text() == "unit test";
64 "Menu length language can be defined - with _MENU_ macro",
67 oTable = $('#example').dataTable( {
69 "sLengthMenu": "unit _MENU_ test"
72 oSettings = oTable.fnSettings();
75 var anChildren = $('label',oSettings.aanFeatures.l[0])[0].childNodes;
77 anChildren[0].nodeValue == "unit " &&
78 anChildren[2].nodeValue == " test";
85 "Only the _MENU_ macro",
88 oTable = $('#example').dataTable( {
90 "sLengthMenu": "_MENU_"
93 oSettings = oTable.fnSettings();
96 var anChildren = oSettings.aanFeatures.l[0].childNodes;
98 anChildren.length == 1 &&
99 $('select', oSettings.aanFeatures.l[0]).length == 1;