/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/sPaginationType.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/sPaginationType.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 2822 byte(s)
initial import
1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "sPaginationType" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
8
9 oTest.fnTest(
10 "Check two button paging is the default",
11 null,
12 function () { return oSettings.sPaginationType == "two_button"; }
13 );
14
15 oTest.fnTest(
16 "Check class is applied",
17 null,
18 function () { return $('#example_paginate').hasClass('paging_two_button'); }
19 );
20
21 oTest.fnTest(
22 "Two A elements are in the wrapper",
23 null,
24 function () { return $('#example_paginate a').length == 2; }
25 );
26
27 oTest.fnTest(
28 "We have the previous button",
29 null,
30 function () { return document.getElementById('example_previous'); }
31 );
32
33 oTest.fnTest(
34 "We have the next button",
35 null,
36 function () { return document.getElementById('example_next'); }
37 );
38
39 oTest.fnTest(
40 "Previous button is disabled",
41 null,
42 function () { return $('#example_previous').hasClass('paginate_disabled_previous'); }
43 );
44
45 oTest.fnTest(
46 "Next button is enabled",
47 null,
48 function () { return $('#example_next').hasClass('paginate_enabled_next'); }
49 );
50
51 /* Don't test paging - that's done by the zero config test script. */
52
53
54 /* Two buttons paging */
55 oTest.fnTest(
56 "Can enabled full numbers paging",
57 function () {
58 oSession.fnRestore();
59 oTable = $('#example').dataTable( {
60 "sPaginationType": "full_numbers"
61 } );
62 oSettings = oTable.fnSettings();
63 },
64 function () { return oSettings.sPaginationType == "full_numbers"; }
65 );
66
67 oTest.fnTest(
68 "Check full numbers class is applied",
69 null,
70 function () { return $('#example_paginate').hasClass('paging_full_numbers'); }
71 );
72
73
74 var nFirst, nPrevious, nNext, nLast;
75 oTest.fnTest(
76 "Jump to last page",
77 function () {
78 nFirst = $('div.dataTables_paginate a.first');
79 nPrevious = $('div.dataTables_paginate a.previous');
80 nNext = $('div.dataTables_paginate a.next');
81 nLast = $('div.dataTables_paginate a.last');
82 nLast.click();
83 },
84 function () {
85 return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries";
86 }
87 );
88
89 oTest.fnTest(
90 "Go to two pages previous",
91 function () {
92 nPrevious.click();
93 nPrevious.click();
94 },
95 function () {
96 return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries";
97 }
98 );
99
100 oTest.fnTest(
101 "Next (second last) page",
102 function () {
103 nNext.click();
104 },
105 function () {
106 return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries";
107 }
108 );
109
110 oTest.fnTest(
111 "Jump to first page",
112 function () {
113 nFirst.click();
114 },
115 function () {
116 return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries";
117 }
118 );
119
120
121 oTest.fnComplete();
122 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20