11define ( [
2+ "qunit" ,
23 "jquery" ,
34 "ui/widgets/checkboxradio"
4- ] , function ( $ ) {
5+ ] , function ( QUnit , $ ) {
56
6- module ( "Checkboxradio: core" ) ;
7+ QUnit . module ( "Checkboxradio: core" ) ;
78
8- test ( "Checkbox - Initial class structure" , function ( assert ) {
9- expect ( 2 ) ;
9+ QUnit . test ( "Checkbox - Initial class structure" , function ( assert ) {
10+ assert . expect ( 2 ) ;
1011 var input = $ ( "#check" ) ,
1112 label = $ ( "label[for=check]" ) ;
1213
@@ -15,8 +16,8 @@ test( "Checkbox - Initial class structure", function( assert ) {
1516 assert . hasClasses ( label , "ui-button ui-widget ui-checkboxradio-label ui-corner-all" ) ;
1617} ) ;
1718
18- test ( "Radios - Initial class structure" , function ( assert ) {
19- expect ( 6 ) ;
19+ QUnit . test ( "Radios - Initial class structure" , function ( assert ) {
20+ assert . expect ( 6 ) ;
2021 var inputs = $ ( "#radio0 input" ) ,
2122 labels = $ ( "#radio0 label" ) ;
2223
@@ -29,12 +30,13 @@ test( "Radios - Initial class structure", function( assert ) {
2930 } ) ;
3031} ) ;
3132
32- asyncTest ( "Ensure checked after single click on checkbox label button" , function ( assert ) {
33- expect ( 2 ) ;
33+ QUnit . test ( "Ensure checked after single click on checkbox label button" , function ( assert ) {
34+ var ready = assert . async ( ) ;
35+ assert . expect ( 2 ) ;
3436
3537 $ ( "#check2" ) . checkboxradio ( ) . change ( function ( ) {
3638 var label = $ ( this ) . checkboxradio ( "widget" ) ;
37- ok ( this . checked , "checked ok" ) ;
39+ assert . ok ( this . checked , "checked ok" ) ;
3840
3941 assert . hasClasses ( label , "ui-state-active" ) ;
4042 } ) ;
@@ -45,21 +47,21 @@ asyncTest( "Ensure checked after single click on checkbox label button", functio
4547 // tracked down, this delay will have to do.
4648 setTimeout ( function ( ) {
4749 $ ( "#check2" ) . checkboxradio ( "widget" ) . simulate ( "click" ) ;
48- start ( ) ;
50+ ready ( ) ;
4951 } ) ;
5052} ) ;
5153
52- test ( "Handle form association via form attribute" , function ( assert ) {
53- expect ( 4 ) ;
54+ QUnit . test ( "Handle form association via form attribute" , function ( assert ) {
55+ assert . expect ( 4 ) ;
5456
5557 var radio1 = $ ( "#crazy-form-1" ) . checkboxradio ( ) ;
5658 var radio1Label = radio1 . checkboxradio ( "widget" ) ;
5759 var radio2 = $ ( "#crazy-form-2" ) . checkboxradio ( ) ;
5860 var radio2Label = radio2 . checkboxradio ( "widget" ) ;
5961
6062 radio2 . change ( function ( ) {
61- ok ( this . checked , "#2 checked" ) ;
62- ok ( ! radio1 [ 0 ] . checked , "#1 not checked" ) ;
63+ assert . ok ( this . checked , "#2 checked" ) ;
64+ assert . ok ( ! radio1 [ 0 ] . checked , "#1 not checked" ) ;
6365
6466 assert . hasClasses ( radio2Label , "ui-state-active" ) ;
6567 assert . lacksClasses ( radio1Label , "ui-state-active" ) ;
@@ -68,8 +70,8 @@ test( "Handle form association via form attribute", function( assert ) {
6870 radio2Label . simulate ( "click" ) ;
6971} ) ;
7072
71- test ( "Checkbox creation requires a label, and finds it in all cases" , function ( assert ) {
72- expect ( 7 ) ;
73+ QUnit . test ( "Checkbox creation requires a label, and finds it in all cases" , function ( assert ) {
74+ assert . expect ( 7 ) ;
7375 var groups = [
7476 "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" ,
7577 "<span><input type='checkbox' id='t7092b'><label for='t7092b'></label></span>" ,
@@ -88,8 +90,8 @@ test( "Checkbox creation requires a label, and finds it in all cases", function(
8890 } ) ;
8991} ) ;
9092
91- test ( "Calling checkboxradio on an unsupported element throws an error" , function ( assert ) {
92- expect ( 2 ) ;
93+ QUnit . test ( "Calling checkboxradio on an unsupported element throws an error" , function ( assert ) {
94+ assert . expect ( 2 ) ;
9395
9496 var errorMessage =
9597 "Can't create checkboxradio on element.nodeName=div and element.type=undefined" ;
@@ -117,8 +119,8 @@ test( "Calling checkboxradio on an unsupported element throws an error", functio
117119 ) ;
118120} ) ;
119121
120- test ( "Calling checkboxradio on an input with no label throws an error" , function ( assert ) {
121- expect ( 1 ) ;
122+ QUnit . test ( "Calling checkboxradio on an input with no label throws an error" , function ( assert ) {
123+ assert . expect ( 1 ) ;
122124
123125 var errorMessage = "No label found for checkboxradio widget" ;
124126 var error = new Error ( errorMessage ) ;
0 commit comments