diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/controlgroup/core.js | 13 | ||||
-rw-r--r-- | tests/unit/controlgroup/methods.js | 33 | ||||
-rw-r--r-- | tests/unit/controlgroup/options.js | 43 |
3 files changed, 46 insertions, 43 deletions
diff --git a/tests/unit/controlgroup/core.js b/tests/unit/controlgroup/core.js index 775d22ade..c1b1556aa 100644 --- a/tests/unit/controlgroup/core.js +++ b/tests/unit/controlgroup/core.js @@ -1,15 +1,16 @@ define( [ + "qunit", "jquery", "ui/widgets/controlgroup", "ui/widgets/checkboxradio", "ui/widgets/selectmenu", "ui/widgets/button" -], function( $ ) { +], function( QUnit, $ ) { -module( "Controlgroup: Core" ); +QUnit.module( "Controlgroup: Core" ); -test( "selectmenu: open/close corners", function( assert ) { - expect( 12 ); +QUnit.test( "selectmenu: open/close corners", function( assert ) { + assert.expect( 12 ); var element = $( ".controlgroup" ).controlgroup(), selects = element.find( "select" ), selectButton = selects.eq( 0 ).selectmenu( "widget" ); @@ -64,8 +65,8 @@ test( "selectmenu: open/close corners", function( assert ) { "vertical: Last selectmenu gets ui-corner-bottom when closed" ); } ); -test( "selectmenu: controlgroupLabel", function( assert ) { - expect( 2 ); +QUnit.test( "selectmenu: controlgroupLabel", function( assert ) { + assert.expect( 2 ); var element = $( ".controlgroup" ).controlgroup(); var label = element.find( ".ui-controlgroup-label" ); diff --git a/tests/unit/controlgroup/methods.js b/tests/unit/controlgroup/methods.js index 4bc384f5e..94f189747 100644 --- a/tests/unit/controlgroup/methods.js +++ b/tests/unit/controlgroup/methods.js @@ -1,35 +1,36 @@ define( [ + "qunit", "jquery", "ui/widgets/controlgroup", "ui/widgets/checkboxradio", "ui/widgets/selectmenu", "ui/widgets/button" -], function( $ ) { +], function( QUnit, $ ) { -module( "Controlgroup: methods" ); +QUnit.module( "Controlgroup: methods" ); -test( "destroy", function( assert ) { - expect( 1 ); +QUnit.test( "destroy", function( assert ) { + assert.expect( 1 ); assert.domEqual( ".controlgroup", function() { $( ".controlgroup" ).controlgroup().controlgroup( "destroy" ); } ); } ); -test( "disable", function( assert ) { - expect( 2 ); +QUnit.test( "disable", function( assert ) { + assert.expect( 2 ); var element = $( ".controlgroup" ).controlgroup().controlgroup( "disable" ); assert.lacksClasses( element, "ui-state-disabled", "The widget does not get the disabled class, because we disable each child widget" ); - strictEqual( element.find( ".ui-state-disabled" ).length, 6, + assert.strictEqual( element.find( ".ui-state-disabled" ).length, 6, "Child widgets are disabled" ); } ); -test( "enable", function( assert ) { - expect( 2 ); +QUnit.test( "enable", function( assert ) { + assert.expect( 2 ); var element = $( ".controlgroup" ).controlgroup().controlgroup( "enable" ); assert.lacksClasses( element, "ui-state-disabled", "ui-state-disabled is not present on widget after enabling" ); - strictEqual( element.find( "ui-state-disabled" ).length, 0, + assert.strictEqual( element.find( "ui-state-disabled" ).length, 0, "Child widgets are disabled" ); } ); @@ -59,8 +60,8 @@ $.each( tests, function( widget, html ) { // Check in both horizontal and vertical orientations $.each( orientations, function( name, classes ) { - test( "refresh: " + widget + ": " + name, function( assert ) { - expect( 41 ); + QUnit.test( "refresh: " + widget + ": " + name, function( assert ) { + assert.expect( 41 ); var i, control, currentClasses, controls = [], @@ -68,7 +69,7 @@ $.each( tests, function( widget, html ) { direction: name } ).appendTo( "body" ); - // checks the elements with in the controlgroup against the expected class list + // Checks the elements with in the controlgroup against the expected class list function checkCornerClasses( classList ) { for ( var j = 0; j < 4; j++ ) { if ( classList[ j ] ) { @@ -118,14 +119,14 @@ $.each( tests, function( widget, html ) { // Refresh the controlgroup now that its populated element.controlgroup( "refresh" ); for ( i = 0; i < 4; i++ ) { - strictEqual( controls[ i ].is( ":ui-" + widget ), true, + assert.strictEqual( controls[ i ].is( ":ui-" + widget ), true, name + ": " + widget + " " + i + ": is a " + widget + " widget" ); } // Check that we have the right classes checkCornerClasses( classes ); - // hide each element and then check its classes + // Hide each element and then check its classes iterateHidden( true ); // Set the exclude option to false so we no longer care about hidden @@ -141,7 +142,7 @@ $.each( tests, function( widget, html ) { assert.hasClasses( controls[ 0 ][ widget ]( "widget" ), "ui-state-disabled" ); - // remove the controlgroup before we start the next set + // Remove the controlgroup before we start the next set element.remove(); } ); } ); diff --git a/tests/unit/controlgroup/options.js b/tests/unit/controlgroup/options.js index 565d4b893..674bc0d59 100644 --- a/tests/unit/controlgroup/options.js +++ b/tests/unit/controlgroup/options.js @@ -1,27 +1,28 @@ define( [ + "qunit", "jquery", "ui/widgets/controlgroup", "ui/widgets/checkboxradio", "ui/widgets/selectmenu", "ui/widgets/button" -], function( $ ) { +], function( QUnit, $ ) { -module( "Controlgroup: options" ); +QUnit.module( "Controlgroup: options" ); -test( "disabled", function( assert ) { - expect( 4 ); +QUnit.test( "disabled", function( assert ) { + assert.expect( 4 ); var element = $( ".controlgroup" ).controlgroup().controlgroup( "option", "disabled", true ); assert.lacksClasses( element, "ui-state-disabled" ); - equal( element.find( ".ui-state-disabled" ).length, 6, "Child widgets are disabled" ); + assert.equal( element.find( ".ui-state-disabled" ).length, 6, "Child widgets are disabled" ); element.controlgroup( "option", "disabled", false ); assert.lacksClasses( element, "ui-state-disabled" ); - strictEqual( element.find( ".ui-state-disabled" ).length, 0, "Child widgets are not disabled" ); + assert.strictEqual( element.find( ".ui-state-disabled" ).length, 0, "Child widgets are not disabled" ); } ); -test( "items - null", function() { - expect( 2 ); +QUnit.test( "items - null", function( assert ) { + assert.expect( 2 ); var element = $( ".controlgroup" ).controlgroup( { items: { "button": null, @@ -30,24 +31,24 @@ test( "items - null", function() { } } ); - strictEqual( element.children( ".ui-button" ).length, 0, + assert.strictEqual( element.children( ".ui-button" ).length, 0, "Child widgets are not called when selector is null" ); element.controlgroup( "option", "items", { "button": "button" } ); - strictEqual( element.children( ".ui-button" ).length, 2, + assert.strictEqual( element.children( ".ui-button" ).length, 2, "Correct child widgets are called when selector is updated" ); } ); -test( "items: custom selector", function() { - expect( 1 ); +QUnit.test( "items: custom selector", function( assert ) { + assert.expect( 1 ); var element = $( ".controlgroup" ).controlgroup( { items: { "button": ".button" } } ); - strictEqual( element.children( ".ui-button" ).length, 4, + assert.strictEqual( element.children( ".ui-button" ).length, 4, "Correct child widgets are called when custom selector used" ); } ); @@ -60,22 +61,22 @@ $.widget( "ui.test", { refresh: $.noop } ); -test( "items: custom widget", function() { - expect( 2 ); +QUnit.test( "items: custom widget", function( assert ) { + assert.expect( 2 ); var element = $( ".controlgroup" ).controlgroup( { items: { "test": ".test" } } ); - strictEqual( element.children( ".ui-button" ).length, 7, + assert.strictEqual( element.children( ".ui-button" ).length, 7, "Correct child widgets are called when custom selector used" ); - strictEqual( element.children( ".ui-test" ).length, 1, + assert.strictEqual( element.children( ".ui-test" ).length, 1, "Custom widget called" ); } ); -test( "onlyVisible", function( assert ) { - expect( 4 ); +QUnit.test( "onlyVisible", function( assert ) { + assert.expect( 4 ); var element = $( ".controlgroup" ).controlgroup( { onlyVisible: false } ), @@ -91,8 +92,8 @@ test( "onlyVisible", function( assert ) { "onlyVisible: true: First button is hidden second button get corner class" ); } ); -test( "direction", function( assert ) { - expect( 6 ); +QUnit.test( "direction", function( assert ) { + assert.expect( 6 ); var element = $( ".controlgroup" ).controlgroup(), buttons = element.children( ".ui-button" ).filter( ":visible" ); |