Prettier JQuery tables
[contractdashboard.git] / media / unit_testing / tests_onhold / 2_js / iDisplayLength.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// DATA_TEMPLATE: js_data
oTest.fnStart( "iDisplayLength" );
 
$(document).ready( function () {
        /* Check the default */
        $('#example').dataTable( {
                "aaData": gaaData
        } );
        
        oTest.fnTest( 
                "Default length is ten",
                null,
                function () { return $('#example tbody tr').length == 10; }
        );
        
        oTest.fnTest( 
                "Select menu shows 10",
                null,
                function () { return $('#example_length select').val() == 10; }
        );
        
        
        oTest.fnTest( 
                "Set initial length to 25",
                function () {
                        oSession.fnRestore();
                        $('#example').dataTable( {
                                "aaData": gaaData,
                                "iDisplayLength": 25
                        } );
                },
                function () { return $('#example tbody tr').length == 25; }
        );
        
        oTest.fnTest( 
                "Select menu shows 25",
                null,
                function () { return $('#example_length select').val() == 25; }
        );
        
        
        oTest.fnTest( 
                "Set initial length to 100",
                function () {
                        oSession.fnRestore();
                        $('#example').dataTable( {
                                "aaData": gaaData,
                                "iDisplayLength": 100
                        } );
                },
                function () { return $('#example tbody tr').length == 57; }
        );
        
        oTest.fnTest( 
                "Select menu shows 25",
                null,
                function () { return $('#example_length select').val() == 100; }
        );
        
        
        oTest.fnTest( 
                "Set initial length to 23 (unknown select menu length)",
                function () {
                        oSession.fnRestore();
                        $('#example').dataTable( {
                                "aaData": gaaData,
                                "iDisplayLength": 23
                        } );
                },
                function () { return $('#example tbody tr').length == 23; }
        );
        
        oTest.fnTest( 
                "Select menu shows 10 (since 23 is unknow)",
                null,
                function () { return $('#example_length select').val() == 10; }
        );
        
        
        oTest.fnComplete();
} );