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