1
1
define ( [
2
+ "qunit" ,
2
3
"jquery" ,
3
4
"./helper" ,
4
5
"ui/widgets/resizable"
5
- ] , function ( $ , testHelper ) {
6
+ ] , function ( QUnit , $ , testHelper ) {
6
7
7
- module ( "resizable: core" ) ;
8
+ QUnit . module ( "resizable: core" ) ;
8
9
9
10
/*
10
- test ("element types", function() {
11
+ Test ("element types", function() {
11
12
var typeNames = ("p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form"
12
13
+ ",table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr"
13
14
+ ",acronym,code,samp,kbd,var,img,object,hr"
@@ -25,133 +26,133 @@ test("element types", function() {
25
26
});
26
27
*/
27
28
28
- test ( "n" , function ( ) {
29
- expect ( 4 ) ;
29
+ QUnit . test ( "n" , function ( assert ) {
30
+ assert . expect ( 4 ) ;
30
31
31
32
var handle = ".ui-resizable-n" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
32
33
33
34
testHelper . drag ( handle , 0 , - 50 ) ;
34
- equal ( target . height ( ) , 150 , "compare height" ) ;
35
+ assert . equal ( target . height ( ) , 150 , "compare height" ) ;
35
36
36
37
testHelper . drag ( handle , 0 , 50 ) ;
37
- equal ( target . height ( ) , 100 , "compare height" ) ;
38
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
38
39
39
- equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
40
- equal ( target [ 0 ] . style . width , "" , "width should not be modified" ) ;
40
+ assert . equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
41
+ assert . equal ( target [ 0 ] . style . width , "" , "width should not be modified" ) ;
41
42
} ) ;
42
43
43
- test ( "s" , function ( ) {
44
- expect ( 5 ) ;
44
+ QUnit . test ( "s" , function ( assert ) {
45
+ assert . expect ( 5 ) ;
45
46
46
47
var handle = ".ui-resizable-s" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
47
48
48
49
testHelper . drag ( handle , 0 , 50 ) ;
49
- equal ( target . height ( ) , 150 , "compare height" ) ;
50
+ assert . equal ( target . height ( ) , 150 , "compare height" ) ;
50
51
51
52
testHelper . drag ( handle , 0 , - 50 ) ;
52
- equal ( target . height ( ) , 100 , "compare height" ) ;
53
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
53
54
54
- equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
55
- equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
56
- equal ( target [ 0 ] . style . width , "" , "width should not be modified" ) ;
55
+ assert . equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
56
+ assert . equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
57
+ assert . equal ( target [ 0 ] . style . width , "" , "width should not be modified" ) ;
57
58
} ) ;
58
59
59
- test ( "e" , function ( ) {
60
- expect ( 5 ) ;
60
+ QUnit . test ( "e" , function ( assert ) {
61
+ assert . expect ( 5 ) ;
61
62
62
63
var handle = ".ui-resizable-e" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
63
64
64
65
testHelper . drag ( handle , 50 ) ;
65
- equal ( target . width ( ) , 150 , "compare width" ) ;
66
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
66
67
67
68
testHelper . drag ( handle , - 50 ) ;
68
- equal ( target . width ( ) , 100 , "compare width" ) ;
69
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
69
70
70
- equal ( target [ 0 ] . style . height , "" , "height should not be modified" ) ;
71
- equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
72
- equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
71
+ assert . equal ( target [ 0 ] . style . height , "" , "height should not be modified" ) ;
72
+ assert . equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
73
+ assert . equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
73
74
} ) ;
74
75
75
- test ( "w" , function ( ) {
76
- expect ( 4 ) ;
76
+ QUnit . test ( "w" , function ( assert ) {
77
+ assert . expect ( 4 ) ;
77
78
78
79
var handle = ".ui-resizable-w" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
79
80
80
81
testHelper . drag ( handle , - 50 ) ;
81
- equal ( target . width ( ) , 150 , "compare width" ) ;
82
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
82
83
83
84
testHelper . drag ( handle , 50 ) ;
84
- equal ( target . width ( ) , 100 , "compare width" ) ;
85
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
85
86
86
- equal ( target [ 0 ] . style . height , "" , "height should not be modified" ) ;
87
- equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
87
+ assert . equal ( target [ 0 ] . style . height , "" , "height should not be modified" ) ;
88
+ assert . equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
88
89
} ) ;
89
90
90
- test ( "ne" , function ( ) {
91
- expect ( 5 ) ;
91
+ QUnit . test ( "ne" , function ( assert ) {
92
+ assert . expect ( 5 ) ;
92
93
93
94
var handle = ".ui-resizable-ne" , target = $ ( "#resizable1" ) . css ( { overflow : "hidden" } ) . resizable ( { handles : "all" } ) ;
94
95
95
96
testHelper . drag ( handle , - 50 , - 50 ) ;
96
- equal ( target . width ( ) , 50 , "compare width" ) ;
97
- equal ( target . height ( ) , 150 , "compare height" ) ;
97
+ assert . equal ( target . width ( ) , 50 , "compare width" ) ;
98
+ assert . equal ( target . height ( ) , 150 , "compare height" ) ;
98
99
99
100
testHelper . drag ( handle , 50 , 50 ) ;
100
- equal ( target . width ( ) , 100 , "compare width" ) ;
101
- equal ( target . height ( ) , 100 , "compare height" ) ;
101
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
102
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
102
103
103
- equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
104
+ assert . equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
104
105
} ) ;
105
106
106
- test ( "se" , function ( ) {
107
- expect ( 6 ) ;
107
+ QUnit . test ( "se" , function ( assert ) {
108
+ assert . expect ( 6 ) ;
108
109
109
110
var handle = ".ui-resizable-se" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
110
111
111
112
testHelper . drag ( handle , 50 , 50 ) ;
112
- equal ( target . width ( ) , 150 , "compare width" ) ;
113
- equal ( target . height ( ) , 150 , "compare height" ) ;
113
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
114
+ assert . equal ( target . height ( ) , 150 , "compare height" ) ;
114
115
115
116
testHelper . drag ( handle , - 50 , - 50 ) ;
116
- equal ( target . width ( ) , 100 , "compare width" ) ;
117
- equal ( target . height ( ) , 100 , "compare height" ) ;
117
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
118
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
118
119
119
- equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
120
- equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
120
+ assert . equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
121
+ assert . equal ( target [ 0 ] . style . left , "" , "left should not be modified" ) ;
121
122
} ) ;
122
123
123
- test ( "sw" , function ( ) {
124
- expect ( 5 ) ;
124
+ QUnit . test ( "sw" , function ( assert ) {
125
+ assert . expect ( 5 ) ;
125
126
126
127
var handle = ".ui-resizable-sw" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
127
128
128
129
testHelper . drag ( handle , - 50 , - 50 ) ;
129
- equal ( target . width ( ) , 150 , "compare width" ) ;
130
- equal ( target . height ( ) , 50 , "compare height" ) ;
130
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
131
+ assert . equal ( target . height ( ) , 50 , "compare height" ) ;
131
132
132
133
testHelper . drag ( handle , 50 , 50 ) ;
133
- equal ( target . width ( ) , 100 , "compare width" ) ;
134
- equal ( target . height ( ) , 100 , "compare height" ) ;
134
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
135
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
135
136
136
- equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
137
+ assert . equal ( target [ 0 ] . style . top , "" , "top should not be modified" ) ;
137
138
} ) ;
138
139
139
- test ( "nw" , function ( ) {
140
- expect ( 4 ) ;
140
+ QUnit . test ( "nw" , function ( assert ) {
141
+ assert . expect ( 4 ) ;
141
142
142
143
var handle = ".ui-resizable-nw" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
143
144
144
145
testHelper . drag ( handle , - 50 , - 50 ) ;
145
- equal ( target . width ( ) , 150 , "compare width" ) ;
146
- equal ( target . height ( ) , 150 , "compare height" ) ;
146
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
147
+ assert . equal ( target . height ( ) , 150 , "compare height" ) ;
147
148
148
149
testHelper . drag ( handle , 50 , 50 ) ;
149
- equal ( target . width ( ) , 100 , "compare width" ) ;
150
- equal ( target . height ( ) , 100 , "compare height" ) ;
150
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
151
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
151
152
} ) ;
152
153
153
- test ( "handle with complex markup (#8756)" , function ( ) {
154
- expect ( 2 ) ;
154
+ QUnit . test ( "handle with complex markup (#8756)" , function ( assert ) {
155
+ assert . expect ( 2 ) ;
155
156
156
157
$ ( "#resizable1" )
157
158
. append (
@@ -164,14 +165,14 @@ test( "handle with complex markup (#8756)", function() {
164
165
var handle = ".ui-resizable-w div" , target = $ ( "#resizable1" ) . resizable ( { handles : "all" } ) ;
165
166
166
167
testHelper . drag ( handle , - 50 ) ;
167
- equal ( target . width ( ) , 150 , "compare width" ) ;
168
+ assert . equal ( target . width ( ) , 150 , "compare width" ) ;
168
169
169
170
testHelper . drag ( handle , 50 ) ;
170
- equal ( target . width ( ) , 100 , "compare width" ) ;
171
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
171
172
} ) ;
172
173
173
- test ( "resizable accounts for scroll position correctly (#3815)" , function ( ) {
174
- expect ( 4 ) ;
174
+ QUnit . test ( "resizable accounts for scroll position correctly (#3815)" , function ( assert ) {
175
+ assert . expect ( 4 ) ;
175
176
176
177
var position , top , left ,
177
178
container = $ ( "<div style='overflow:scroll;height:300px;width:300px;position:relative;'></div>" ) . appendTo ( "#qunit-fixture" ) ,
@@ -187,14 +188,14 @@ test( "resizable accounts for scroll position correctly (#3815)", function() {
187
188
top = el . css ( "top" ) ;
188
189
189
190
testHelper . drag ( handle , 50 , 50 ) ;
190
- deepEqual ( el . position ( ) , position , "position stays the same when resized" ) ;
191
- equal ( el . css ( "left" ) , left , "css('left') stays the same when resized" ) ;
192
- equal ( el . css ( "top" ) , top , "css('top') stays the same when resized" ) ;
193
- equal ( $ ( handle ) . position ( ) . left , handlePosition + 50 , "handle also moved" ) ;
191
+ assert . deepEqual ( el . position ( ) , position , "position stays the same when resized" ) ;
192
+ assert . equal ( el . css ( "left" ) , left , "css('left') stays the same when resized" ) ;
193
+ assert . equal ( el . css ( "top" ) , top , "css('top') stays the same when resized" ) ;
194
+ assert . equal ( $ ( handle ) . position ( ) . left , handlePosition + 50 , "handle also moved" ) ;
194
195
} ) ;
195
196
196
- test ( "resizable stores correct size when using helper and grid (#9547)" , function ( ) {
197
- expect ( 2 ) ;
197
+ QUnit . test ( "resizable stores correct size when using helper and grid (#9547)" , function ( assert ) {
198
+ assert . expect ( 2 ) ;
198
199
199
200
var handle = ".ui-resizable-se" ,
200
201
target = $ ( "#resizable1" ) . resizable ( {
@@ -204,12 +205,12 @@ test( "resizable stores correct size when using helper and grid (#9547)", functi
204
205
} ) ;
205
206
206
207
testHelper . drag ( handle , 1 , 1 ) ;
207
- equal ( target . width ( ) , 100 , "compare width" ) ;
208
- equal ( target . height ( ) , 100 , "compare height" ) ;
208
+ assert . equal ( target . width ( ) , 100 , "compare width" ) ;
209
+ assert . equal ( target . height ( ) , 100 , "compare height" ) ;
209
210
} ) ;
210
211
211
- test ( "nested resizable" , function ( ) {
212
- expect ( 4 ) ;
212
+ QUnit . test ( "nested resizable" , function ( assert ) {
213
+ assert . expect ( 4 ) ;
213
214
214
215
var outer = $ ( "<div id='outer' style='width:50px'></div>" ) ,
215
216
inner = $ ( "<div id='inner' style='width:30px'></div>" ) ,
@@ -228,14 +229,14 @@ test( "nested resizable", function() {
228
229
outerHandle = $ ( "#outer > .ui-resizable-e" ) ;
229
230
230
231
testHelper . drag ( innerHandle , 10 ) ;
231
- equal ( inner . width ( ) , 40 , "compare width of inner element" ) ;
232
+ assert . equal ( inner . width ( ) , 40 , "compare width of inner element" ) ;
232
233
testHelper . drag ( innerHandle , - 10 ) ;
233
- equal ( inner . width ( ) , 30 , "compare width of inner element" ) ;
234
+ assert . equal ( inner . width ( ) , 30 , "compare width of inner element" ) ;
234
235
235
236
testHelper . drag ( outerHandle , 10 ) ;
236
- equal ( outer . width ( ) , 60 , "compare width of outer element" ) ;
237
+ assert . equal ( outer . width ( ) , 60 , "compare width of outer element" ) ;
237
238
testHelper . drag ( outerHandle , - 10 ) ;
238
- equal ( outer . width ( ) , 50 , "compare width of outer element" ) ;
239
+ assert . equal ( outer . width ( ) , 50 , "compare width of outer element" ) ;
239
240
240
241
inner . remove ( ) ;
241
242
outer . remove ( ) ;
0 commit comments