11define ( [
2+ "qunit" ,
23 "jquery" ,
34 "lib/common" ,
45 "ui/form" ,
56 "ui/labels" ,
67 "ui/unique-id"
7- ] , function ( $ , common ) {
8+ ] , function ( QUnit , $ , common ) {
89
9- module ( "core - jQuery extensions" ) ;
10+ QUnit . module ( "core - jQuery extensions" ) ;
1011
1112common . testJshint ( "core" ) ;
1213
13- test ( "innerWidth - getter" , function ( ) {
14- expect ( 2 ) ;
14+ QUnit . test ( "innerWidth - getter" , function ( assert ) {
15+ assert . expect ( 2 ) ;
1516 var el = $ ( "#dimensions" ) ;
1617
17- equal ( el . innerWidth ( ) , 122 , "getter passthru" ) ;
18+ assert . equal ( el . innerWidth ( ) , 122 , "getter passthru" ) ;
1819 el . hide ( ) ;
19- equal ( el . innerWidth ( ) , 122 , "getter passthru when hidden" ) ;
20+ assert . equal ( el . innerWidth ( ) , 122 , "getter passthru when hidden" ) ;
2021} ) ;
2122
22- test ( "innerWidth - setter" , function ( ) {
23- expect ( 2 ) ;
23+ QUnit . test ( "innerWidth - setter" , function ( assert ) {
24+ assert . expect ( 2 ) ;
2425 var el = $ ( "#dimensions" ) ;
2526
2627 el . innerWidth ( 120 ) ;
27- equal ( el . width ( ) , 98 , "width set properly" ) ;
28+ assert . equal ( el . width ( ) , 98 , "width set properly" ) ;
2829 el . hide ( ) ;
2930 el . innerWidth ( 100 ) ;
30- equal ( el . width ( ) , 78 , "width set properly when hidden" ) ;
31+ assert . equal ( el . width ( ) , 78 , "width set properly when hidden" ) ;
3132} ) ;
3233
33- test ( "innerHeight - getter" , function ( ) {
34- expect ( 2 ) ;
34+ QUnit . test ( "innerHeight - getter" , function ( assert ) {
35+ assert . expect ( 2 ) ;
3536 var el = $ ( "#dimensions" ) ;
3637
37- equal ( el . innerHeight ( ) , 70 , "getter passthru" ) ;
38+ assert . equal ( el . innerHeight ( ) , 70 , "getter passthru" ) ;
3839 el . hide ( ) ;
39- equal ( el . innerHeight ( ) , 70 , "getter passthru when hidden" ) ;
40+ assert . equal ( el . innerHeight ( ) , 70 , "getter passthru when hidden" ) ;
4041} ) ;
4142
42- test ( "innerHeight - setter" , function ( ) {
43- expect ( 2 ) ;
43+ QUnit . test ( "innerHeight - setter" , function ( assert ) {
44+ assert . expect ( 2 ) ;
4445 var el = $ ( "#dimensions" ) ;
4546
4647 el . innerHeight ( 60 ) ;
47- equal ( el . height ( ) , 40 , "height set properly" ) ;
48+ assert . equal ( el . height ( ) , 40 , "height set properly" ) ;
4849 el . hide ( ) ;
4950 el . innerHeight ( 50 ) ;
50- equal ( el . height ( ) , 30 , "height set properly when hidden" ) ;
51+ assert . equal ( el . height ( ) , 30 , "height set properly when hidden" ) ;
5152} ) ;
5253
53- test ( "outerWidth - getter" , function ( ) {
54- expect ( 2 ) ;
54+ QUnit . test ( "outerWidth - getter" , function ( assert ) {
55+ assert . expect ( 2 ) ;
5556 var el = $ ( "#dimensions" ) ;
5657
57- equal ( el . outerWidth ( ) , 140 , "getter passthru" ) ;
58+ assert . equal ( el . outerWidth ( ) , 140 , "getter passthru" ) ;
5859 el . hide ( ) ;
59- equal ( el . outerWidth ( ) , 140 , "getter passthru when hidden" ) ;
60+ assert . equal ( el . outerWidth ( ) , 140 , "getter passthru when hidden" ) ;
6061} ) ;
6162
62- test ( "outerWidth - setter" , function ( ) {
63- expect ( 2 ) ;
63+ QUnit . test ( "outerWidth - setter" , function ( assert ) {
64+ assert . expect ( 2 ) ;
6465 var el = $ ( "#dimensions" ) ;
6566
6667 el . outerWidth ( 130 ) ;
67- equal ( el . width ( ) , 90 , "width set properly" ) ;
68+ assert . equal ( el . width ( ) , 90 , "width set properly" ) ;
6869 el . hide ( ) ;
6970 el . outerWidth ( 120 ) ;
70- equal ( el . width ( ) , 80 , "width set properly when hidden" ) ;
71+ assert . equal ( el . width ( ) , 80 , "width set properly when hidden" ) ;
7172} ) ;
7273
73- test ( "outerWidth(true) - getter" , function ( ) {
74- expect ( 2 ) ;
74+ QUnit . test ( "outerWidth(true) - getter" , function ( assert ) {
75+ assert . expect ( 2 ) ;
7576 var el = $ ( "#dimensions" ) ;
7677
77- equal ( el . outerWidth ( true ) , 154 , "getter passthru w/ margin" ) ;
78+ assert . equal ( el . outerWidth ( true ) , 154 , "getter passthru w/ margin" ) ;
7879 el . hide ( ) ;
79- equal ( el . outerWidth ( true ) , 154 , "getter passthru w/ margin when hidden" ) ;
80+ assert . equal ( el . outerWidth ( true ) , 154 , "getter passthru w/ margin when hidden" ) ;
8081} ) ;
8182
82- test ( "outerWidth(true) - setter" , function ( ) {
83- expect ( 2 ) ;
83+ QUnit . test ( "outerWidth(true) - setter" , function ( assert ) {
84+ assert . expect ( 2 ) ;
8485 var el = $ ( "#dimensions" ) ;
8586
8687 el . outerWidth ( 130 , true ) ;
87- equal ( el . width ( ) , 76 , "width set properly" ) ;
88+ assert . equal ( el . width ( ) , 76 , "width set properly" ) ;
8889 el . hide ( ) ;
8990 el . outerWidth ( 120 , true ) ;
90- equal ( el . width ( ) , 66 , "width set properly when hidden" ) ;
91+ assert . equal ( el . width ( ) , 66 , "width set properly when hidden" ) ;
9192} ) ;
9293
93- test ( "outerHeight - getter" , function ( ) {
94- expect ( 2 ) ;
94+ QUnit . test ( "outerHeight - getter" , function ( assert ) {
95+ assert . expect ( 2 ) ;
9596 var el = $ ( "#dimensions" ) ;
9697
97- equal ( el . outerHeight ( ) , 86 , "getter passthru" ) ;
98+ assert . equal ( el . outerHeight ( ) , 86 , "getter passthru" ) ;
9899 el . hide ( ) ;
99- equal ( el . outerHeight ( ) , 86 , "getter passthru when hidden" ) ;
100+ assert . equal ( el . outerHeight ( ) , 86 , "getter passthru when hidden" ) ;
100101} ) ;
101102
102- test ( "outerHeight - setter" , function ( ) {
103- expect ( 2 ) ;
103+ QUnit . test ( "outerHeight - setter" , function ( assert ) {
104+ assert . expect ( 2 ) ;
104105 var el = $ ( "#dimensions" ) ;
105106
106107 el . outerHeight ( 80 ) ;
107- equal ( el . height ( ) , 44 , "height set properly" ) ;
108+ assert . equal ( el . height ( ) , 44 , "height set properly" ) ;
108109 el . hide ( ) ;
109110 el . outerHeight ( 70 ) ;
110- equal ( el . height ( ) , 34 , "height set properly when hidden" ) ;
111+ assert . equal ( el . height ( ) , 34 , "height set properly when hidden" ) ;
111112} ) ;
112113
113- test ( "outerHeight(true) - getter" , function ( ) {
114- expect ( 2 ) ;
114+ QUnit . test ( "outerHeight(true) - getter" , function ( assert ) {
115+ assert . expect ( 2 ) ;
115116 var el = $ ( "#dimensions" ) ;
116117
117- equal ( el . outerHeight ( true ) , 98 , "getter passthru w/ margin" ) ;
118+ assert . equal ( el . outerHeight ( true ) , 98 , "getter passthru w/ margin" ) ;
118119 el . hide ( ) ;
119- equal ( el . outerHeight ( true ) , 98 , "getter passthru w/ margin when hidden" ) ;
120+ assert . equal ( el . outerHeight ( true ) , 98 , "getter passthru w/ margin when hidden" ) ;
120121} ) ;
121122
122- test ( "outerHeight(true) - setter" , function ( ) {
123- expect ( 2 ) ;
123+ QUnit . test ( "outerHeight(true) - setter" , function ( assert ) {
124+ assert . expect ( 2 ) ;
124125 var el = $ ( "#dimensions" ) ;
125126
126127 el . outerHeight ( 90 , true ) ;
127- equal ( el . height ( ) , 42 , "height set properly" ) ;
128+ assert . equal ( el . height ( ) , 42 , "height set properly" ) ;
128129 el . hide ( ) ;
129130 el . outerHeight ( 80 , true ) ;
130- equal ( el . height ( ) , 32 , "height set properly when hidden" ) ;
131+ assert . equal ( el . height ( ) , 32 , "height set properly when hidden" ) ;
131132} ) ;
132133
133- test ( "uniqueId / removeUniqueId" , function ( ) {
134- expect ( 3 ) ;
134+ QUnit . test ( "uniqueId / removeUniqueId" , function ( assert ) {
135+ assert . expect ( 3 ) ;
135136 var el = $ ( "img" ) . eq ( 0 ) ;
136- equal ( el . attr ( "id" ) , null , "element has no initial id" ) ;
137+ assert . equal ( el . attr ( "id" ) , null , "element has no initial id" ) ;
137138 el . uniqueId ( ) ;
138- ok ( / u i - i d - \d + $ / . test ( el . attr ( "id" ) ) , "element has generated id" ) ;
139+ assert . ok ( / u i - i d - \d + $ / . test ( el . attr ( "id" ) ) , "element has generated id" ) ;
139140 el . removeUniqueId ( ) ;
140- equal ( el . attr ( "id" ) , null , "unique id has been removed from element" ) ;
141+ assert . equal ( el . attr ( "id" ) , null , "unique id has been removed from element" ) ;
141142} ) ;
142143
143- test ( "Labels" , function ( ) {
144- expect ( 2 ) ;
144+ QUnit . test ( "Labels" , function ( assert ) {
145+ assert . expect ( 2 ) ;
145146
146147 var expected = [ "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" ] ;
147148 var dom = $ ( "#labels-fragment" ) ;
@@ -155,7 +156,7 @@ test( "Labels", function() {
155156 return $ . trim ( $ ( this ) . text ( ) ) ;
156157 } ) . get ( ) ;
157158
158- deepEqual ( found , expected ,
159+ assert . deepEqual ( found , expected ,
159160 ".labels() finds all labels in " + testType + ", and sorts them in DOM order" ) ;
160161 }
161162
@@ -176,8 +177,9 @@ test( "Labels", function() {
176177 inputs . each ( function ( ) {
177178 var input = $ ( this ) ;
178179
179- asyncTest ( name + this . id . replace ( / _ / g, " " ) , function ( ) {
180- expect ( 1 ) ;
180+ QUnit . test ( name + this . id . replace ( / _ / g, " " ) , function ( assert ) {
181+ var ready = assert . async ( ) ;
182+ assert . expect ( 1 ) ;
181183 var form = input . form ( ) ;
182184
183185 // If input has a form the value should reset to "" if not it should be "changed"
@@ -193,8 +195,8 @@ test( "Labels", function() {
193195 } ) ;
194196
195197 setTimeout ( function ( ) {
196- equal ( input . val ( ) , value , "Proper form found for #" + input . attr ( "id" ) ) ;
197- start ( ) ;
198+ assert . equal ( input . val ( ) , value , "Proper form found for #" + input . attr ( "id" ) ) ;
199+ ready ( ) ;
198200 } ) ;
199201 } ) ;
200202 } ) ;
0 commit comments