and a note on manual changes in dataTables.bootstrap.css
[myslice.git] / third-party / jquery-ui-1.10.2 / tests / unit / core / core.js
1 (function( $ ) {
2
3 module( "core - jQuery extensions" );
4
5 TestHelpers.testJshint( "core" );
6
7 asyncTest( "focus - original functionality", function() {
8         expect( 1 );
9         $( "#inputTabindex0" )
10                 .one( "focus", function() {
11                         ok( true, "event triggered" );
12                         start();
13                 })
14                 .focus();
15 });
16
17 asyncTest( "focus", function() {
18         expect( 2 );
19         $( "#inputTabindex0" )
20                 .one( "focus", function() {
21                         ok( true, "event triggered" );
22                         start();
23                 })
24                 .focus( 500, function() {
25                         ok( true, "callback triggered" );
26                 });
27 });
28
29 test( "zIndex", function() {
30         expect( 7 );
31         var el = $( "#zIndexAutoWithParent" ),
32                 parent = el.parent();
33         equal( el.zIndex(), 100, "zIndex traverses up to find value" );
34         equal( parent.zIndex(200 ), parent, "zIndex setter is chainable" );
35         equal( el.zIndex(), 200, "zIndex setter changed zIndex" );
36
37         el = $( "#zIndexAutoWithParentViaCSS" );
38         equal( el.zIndex(), 0, "zIndex traverses up to find CSS value, not found because not positioned" );
39
40         el = $( "#zIndexAutoWithParentViaCSSPositioned" );
41         equal( el.zIndex(), 100, "zIndex traverses up to find CSS value" );
42         el.parent().zIndex( 200 );
43         equal( el.zIndex(), 200, "zIndex setter changed zIndex, overriding CSS" );
44
45         equal( $( "#zIndexAutoNoParent" ).zIndex(), 0, "zIndex never explicitly set in hierarchy" );
46 });
47
48 test( "innerWidth - getter", function() {
49         expect( 2 );
50         var el = $( "#dimensions" );
51
52         equal( el.innerWidth(), 122, "getter passthru" );
53         el.hide();
54         equal( el.innerWidth(), 122, "getter passthru when hidden" );
55 });
56
57 test( "innerWidth - setter", function() {
58         expect( 2 );
59         var el = $( "#dimensions" );
60
61         el.innerWidth( 120 );
62         equal( el.width(), 98, "width set properly" );
63         el.hide();
64         el.innerWidth( 100 );
65         equal( el.width(), 78, "width set properly when hidden" );
66 });
67
68 test( "innerHeight - getter", function() {
69         expect( 2 );
70         var el = $( "#dimensions" );
71
72         equal( el.innerHeight(), 70, "getter passthru" );
73         el.hide();
74         equal( el.innerHeight(), 70, "getter passthru when hidden" );
75 });
76
77 test( "innerHeight - setter", function() {
78         expect( 2 );
79         var el = $( "#dimensions" );
80
81         el.innerHeight( 60 );
82         equal( el.height(), 40, "height set properly" );
83         el.hide();
84         el.innerHeight( 50 );
85         equal( el.height(), 30, "height set properly when hidden" );
86 });
87
88 test( "outerWidth - getter", function() {
89         expect( 2 );
90         var el = $( "#dimensions" );
91
92         equal( el.outerWidth(), 140, "getter passthru" );
93         el.hide();
94         equal( el.outerWidth(), 140, "getter passthru when hidden" );
95 });
96
97 test( "outerWidth - setter", function() {
98         expect( 2 );
99         var el = $( "#dimensions" );
100
101         el.outerWidth( 130 );
102         equal( el.width(), 90, "width set properly" );
103         el.hide();
104         el.outerWidth( 120 );
105         equal( el.width(), 80, "width set properly when hidden" );
106 });
107
108 test( "outerWidth(true) - getter", function() {
109         expect( 2 );
110         var el = $( "#dimensions" );
111
112         equal( el.outerWidth(true), 154, "getter passthru w/ margin" );
113         el.hide();
114         equal( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" );
115 });
116
117 test( "outerWidth(true) - setter", function() {
118         expect( 2 );
119         var el = $( "#dimensions" );
120
121         el.outerWidth( 130, true );
122         equal( el.width(), 76, "width set properly" );
123         el.hide();
124         el.outerWidth( 120, true );
125         equal( el.width(), 66, "width set properly when hidden" );
126 });
127
128 test( "outerHeight - getter", function() {
129         expect( 2 );
130         var el = $( "#dimensions" );
131
132         equal( el.outerHeight(), 86, "getter passthru" );
133         el.hide();
134         equal( el.outerHeight(), 86, "getter passthru when hidden" );
135 });
136
137 test( "outerHeight - setter", function() {
138         expect( 2 );
139         var el = $( "#dimensions" );
140
141         el.outerHeight( 80 );
142         equal( el.height(), 44, "height set properly" );
143         el.hide();
144         el.outerHeight( 70 );
145         equal( el.height(), 34, "height set properly when hidden" );
146 });
147
148 test( "outerHeight(true) - getter", function() {
149         expect( 2 );
150         var el = $( "#dimensions" );
151
152         equal( el.outerHeight(true), 98, "getter passthru w/ margin" );
153         el.hide();
154         equal( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" );
155 });
156
157 test( "outerHeight(true) - setter", function() {
158         expect( 2 );
159         var el = $( "#dimensions" );
160
161         el.outerHeight( 90, true );
162         equal( el.height(), 42, "height set properly" );
163         el.hide();
164         el.outerHeight( 80, true );
165         equal( el.height(), 32, "height set properly when hidden" );
166 });
167
168 test( "uniqueId / removeUniqueId", function() {
169         expect( 3 );
170         var el = $( "img" ).eq( 0 );
171
172         // support: jQuery <1.6.2
173         // support: IE <8
174         // We should use strictEqual( id, undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
175         ok( !el.attr( "id" ), "element has no initial id" );
176         el.uniqueId();
177         ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" );
178         el.removeUniqueId();
179         // support: jQuery <1.6.2
180         // support: IE <8
181         // see above
182         ok( !el.attr( "id" ), "unique id has been removed from element" );
183 });
184
185 })( jQuery );