Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HeuristicLabWeb.PluginHost/HLWebPluginHost/Content/jQuery/jQueryPlugins/DataTables-1.7.6/media/unit_testing/tests_onhold/1_dom/bLengthChange.js @ 6286

Last change on this file since 6286 was 6286, checked in by dkahn, 13 years ago

#1198 Added jQuery plus plugins

File size: 1.6 KB
Line 
1// DATA_TEMPLATE: dom_data
2oTest.fnStart( "bLengthChange" );
3
4$(document).ready( function () {
5  /* Check the default */
6  $('#example').dataTable();
7 
8  oTest.fnTest(
9    "Length div exists by default",
10    null,
11    function () { return document.getElementById('example_length') != null; }
12  );
13 
14  oTest.fnTest(
15    "Four default options",
16    null,
17    function () { return $("select[name=example_length] option").length == 4; }
18  );
19 
20  oTest.fnTest(
21    "Default options",
22    null,
23    function () {
24      var opts = $("select[name='example_length'] option");
25      return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 &&
26        opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100;
27    }
28  );
29 
30  oTest.fnTest(
31    "Info takes length into account",
32    null,
33    function () { return document.getElementById('example_info').innerHTML ==
34      "Showing 1 to 10 of 57 entries"; }
35  );
36 
37  /* Check can disable */
38  oTest.fnTest(
39    "Change length can be disabled",
40    function () {
41      oSession.fnRestore();
42      $('#example').dataTable( {
43        "bLengthChange": false
44      } );
45    },
46    function () { return document.getElementById('example_length') == null; }
47  );
48 
49  oTest.fnTest(
50    "Information takes length disabled into account",
51    null,
52    function () { return document.getElementById('example_info').innerHTML ==
53      "Showing 1 to 10 of 57 entries"; }
54  );
55 
56  /* Enable makes no difference */
57  oTest.fnTest(
58    "Length change enabled override",
59    function () {
60      oSession.fnRestore();
61      $('#example').dataTable( {
62        "bLengthChange": true
63      } );
64    },
65    function () { return document.getElementById('example_length') != null; }
66  );
67 
68 
69 
70  oTest.fnComplete();
71} );
Note: See TracBrowser for help on using the repository browser.