aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu/options.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/selectmenu/options.js')
-rw-r--r--tests/unit/selectmenu/options.js55
1 files changed, 28 insertions, 27 deletions
diff --git a/tests/unit/selectmenu/options.js b/tests/unit/selectmenu/options.js
index 0ac13ed6d..193ea688e 100644
--- a/tests/unit/selectmenu/options.js
+++ b/tests/unit/selectmenu/options.js
@@ -1,20 +1,21 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/selectmenu"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "selectmenu: options" );
+QUnit.module( "selectmenu: options" );
-test( "appendTo: null", function() {
- expect( 1 );
+QUnit.test( "appendTo: null", function( assert ) {
+ assert.expect( 1 );
var element = $( "#speed" ).selectmenu();
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body,
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], document.body,
"defaults to body" );
} );
-test( "appendTo: explicit", function() {
- expect( 6 );
+QUnit.test( "appendTo: explicit", function( assert ) {
+ assert.expect( 6 );
var detached = $( "<div>" ),
element = $( "#speed" );
@@ -22,56 +23,56 @@ test( "appendTo: explicit", function() {
element.selectmenu( {
appendTo: ".selectmenu-wrap"
} );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap1" )[ 0 ], "first found element" );
- equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
+ assert.equal( $( "#selectmenu-wrap2 .ui-selectmenu" ).length, 0, "only appends to one element" );
element.selectmenu( "destroy" );
element.selectmenu().selectmenu( "option", "appendTo", "#selectmenu-wrap1" );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap1" )[ 0 ], "modified after init" );
element.selectmenu( "destroy" );
element.selectmenu( {
appendTo: detached
} );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached jQuery object" );
element.selectmenu( "destroy" );
element.selectmenu( {
appendTo: detached[ 0 ]
} );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached DOM element" );
element.selectmenu( "destroy" );
element.selectmenu().selectmenu( "option", "appendTo", detached );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ], detached[ 0 ],
"detached DOM element via option()" );
element.selectmenu( "destroy" );
} );
-test( "appendTo: ui-front", function() {
- expect( 2 );
+QUnit.test( "appendTo: ui-front", function( assert ) {
+ assert.expect( 2 );
var element = $( "#speed" );
$( "#selectmenu-wrap2" ).addClass( "ui-front" );
element.selectmenu();
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap2" )[ 0 ], "null, inside .ui-front" );
element.selectmenu( "destroy" );
element.selectmenu( {
appendTo: $()
} );
- equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
+ assert.equal( element.selectmenu( "menuWidget" ).parent().parent()[ 0 ],
$( "#selectmenu-wrap2" )[ 0 ], "empty jQuery object, inside .ui-front" );
} );
-test( "CSS styles", function( assert ) {
- expect( 5 );
+QUnit.test( "CSS styles", function( assert ) {
+ assert.expect( 5 );
var element = $( "#speed" ).selectmenu(),
button = element.selectmenu( "widget" ),
@@ -86,8 +87,8 @@ test( "CSS styles", function( assert ) {
assert.lacksClasses( button, "ui-corner-all" );
} );
-test( "width", function() {
- expect( 6 );
+QUnit.test( "width", function( assert ) {
+ assert.expect( 6 );
var button,
element = $( "#speed" );
@@ -95,26 +96,26 @@ test( "width", function() {
element.selectmenu();
button = element.selectmenu( "widget" );
- equal( button[ 0 ].style.width, "", "no inline style" );
+ assert.equal( button[ 0 ].style.width, "", "no inline style" );
element.selectmenu( "option", "width", null );
- equal( button.outerWidth(), element.outerWidth(), "button width auto" );
+ assert.equal( button.outerWidth(), element.outerWidth(), "button width auto" );
element.outerWidth( 100 );
element.selectmenu( "refresh" );
- equal( button.outerWidth(), 100, "button width set by CSS" );
+ assert.equal( button.outerWidth(), 100, "button width set by CSS" );
element
.width( "" )
.selectmenu( "option", "width", 100 )
.selectmenu( "refresh" );
- equal( button.outerWidth(), 100, "button width set by JS option" );
+ assert.equal( button.outerWidth(), 100, "button width set by JS option" );
element
.append( $( "<option>", { text: "Option with a little longer text" } ) )
.selectmenu( "option", "width", null )
.selectmenu( "refresh" );
- equal( button.outerWidth(), element.outerWidth(), "button width with long option" );
+ assert.equal( button.outerWidth(), element.outerWidth(), "button width with long option" );
element.parent().outerWidth( 300 );
element
@@ -122,7 +123,7 @@ test( "width", function() {
.css( "width", "100%" )
.selectmenu( { width: null } );
button = element.selectmenu( "widget" );
- equal( button.outerWidth(), 300, "button width fills container" );
+ assert.equal( button.outerWidth(), 300, "button width fills container" );
} );
} );