1
1
define ( [
2
+ "qunit" ,
2
3
"jquery" ,
3
4
"ui/widgets/controlgroup" ,
4
5
"ui/widgets/checkboxradio" ,
5
6
"ui/widgets/selectmenu" ,
6
7
"ui/widgets/button"
7
- ] , function ( $ ) {
8
+ ] , function ( QUnit , $ ) {
8
9
9
- module ( "Controlgroup: options" ) ;
10
+ QUnit . module ( "Controlgroup: options" ) ;
10
11
11
- test ( "disabled" , function ( assert ) {
12
- expect ( 4 ) ;
12
+ QUnit . test ( "disabled" , function ( assert ) {
13
+ assert . expect ( 4 ) ;
13
14
var element = $ ( ".controlgroup" ) . controlgroup ( ) . controlgroup ( "option" , "disabled" , true ) ;
14
15
assert . lacksClasses ( element , "ui-state-disabled" ) ;
15
- equal ( element . find ( ".ui-state-disabled" ) . length , 6 , "Child widgets are disabled" ) ;
16
+ assert . equal ( element . find ( ".ui-state-disabled" ) . length , 6 , "Child widgets are disabled" ) ;
16
17
17
18
element . controlgroup ( "option" , "disabled" , false ) ;
18
19
assert . lacksClasses ( element , "ui-state-disabled" ) ;
19
- strictEqual ( element . find ( ".ui-state-disabled" ) . length , 0 , "Child widgets are not disabled" ) ;
20
+ assert . strictEqual ( element . find ( ".ui-state-disabled" ) . length , 0 , "Child widgets are not disabled" ) ;
20
21
21
22
} ) ;
22
23
23
- test ( "items - null" , function ( ) {
24
- expect ( 2 ) ;
24
+ QUnit . test ( "items - null" , function ( assert ) {
25
+ assert . expect ( 2 ) ;
25
26
var element = $ ( ".controlgroup" ) . controlgroup ( {
26
27
items : {
27
28
"button" : null ,
@@ -30,24 +31,24 @@ test( "items - null", function() {
30
31
}
31
32
} ) ;
32
33
33
- strictEqual ( element . children ( ".ui-button" ) . length , 0 ,
34
+ assert . strictEqual ( element . children ( ".ui-button" ) . length , 0 ,
34
35
"Child widgets are not called when selector is null" ) ;
35
36
36
37
element . controlgroup ( "option" , "items" , {
37
38
"button" : "button"
38
39
} ) ;
39
- strictEqual ( element . children ( ".ui-button" ) . length , 2 ,
40
+ assert . strictEqual ( element . children ( ".ui-button" ) . length , 2 ,
40
41
"Correct child widgets are called when selector is updated" ) ;
41
42
} ) ;
42
43
43
- test ( "items: custom selector" , function ( ) {
44
- expect ( 1 ) ;
44
+ QUnit . test ( "items: custom selector" , function ( assert ) {
45
+ assert . expect ( 1 ) ;
45
46
var element = $ ( ".controlgroup" ) . controlgroup ( {
46
47
items : {
47
48
"button" : ".button"
48
49
}
49
50
} ) ;
50
- strictEqual ( element . children ( ".ui-button" ) . length , 4 ,
51
+ assert . strictEqual ( element . children ( ".ui-button" ) . length , 4 ,
51
52
"Correct child widgets are called when custom selector used" ) ;
52
53
} ) ;
53
54
@@ -60,22 +61,22 @@ $.widget( "ui.test", {
60
61
refresh : $ . noop
61
62
} ) ;
62
63
63
- test ( "items: custom widget" , function ( ) {
64
- expect ( 2 ) ;
64
+ QUnit . test ( "items: custom widget" , function ( assert ) {
65
+ assert . expect ( 2 ) ;
65
66
var element = $ ( ".controlgroup" ) . controlgroup ( {
66
67
items : {
67
68
"test" : ".test"
68
69
}
69
70
} ) ;
70
71
71
- strictEqual ( element . children ( ".ui-button" ) . length , 7 ,
72
+ assert . strictEqual ( element . children ( ".ui-button" ) . length , 7 ,
72
73
"Correct child widgets are called when custom selector used" ) ;
73
- strictEqual ( element . children ( ".ui-test" ) . length , 1 ,
74
+ assert . strictEqual ( element . children ( ".ui-test" ) . length , 1 ,
74
75
"Custom widget called" ) ;
75
76
} ) ;
76
77
77
- test ( "onlyVisible" , function ( assert ) {
78
- expect ( 4 ) ;
78
+ QUnit . test ( "onlyVisible" , function ( assert ) {
79
+ assert . expect ( 4 ) ;
79
80
var element = $ ( ".controlgroup" ) . controlgroup ( {
80
81
onlyVisible : false
81
82
} ) ,
@@ -91,8 +92,8 @@ test( "onlyVisible", function( assert ) {
91
92
"onlyVisible: true: First button is hidden second button get corner class" ) ;
92
93
} ) ;
93
94
94
- test ( "direction" , function ( assert ) {
95
- expect ( 6 ) ;
95
+ QUnit . test ( "direction" , function ( assert ) {
96
+ assert . expect ( 6 ) ;
96
97
var element = $ ( ".controlgroup" ) . controlgroup ( ) ,
97
98
buttons = element . children ( ".ui-button" ) . filter ( ":visible" ) ;
98
99
0 commit comments