aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/deprecated.js
diff options
context:
space:
mode:
authorAmanpreet Singh <apsdehal@gmail.com>2016-04-03 20:13:27 +0530
committerAmanpreet Singh <apsdehal@gmail.com>2016-04-14 00:06:11 +0530
commitf375fd1300b4e08c0e71a073131260dfb8e5762f (patch)
tree467dcec8f29c8cc272946545c4264f21b8e580b4 /tests/unit/button/deprecated.js
parentd83db4f5284df9fd80c3a98b1a3c5b6ca31b0c9a (diff)
downloadjquery-ui-f375fd1300b4e08c0e71a073131260dfb8e5762f.tar.gz
jquery-ui-f375fd1300b4e08c0e71a073131260dfb8e5762f.zip
Button: Shift to no globals
Diffstat (limited to 'tests/unit/button/deprecated.js')
-rw-r--r--tests/unit/button/deprecated.js101
1 files changed, 51 insertions, 50 deletions
diff --git a/tests/unit/button/deprecated.js b/tests/unit/button/deprecated.js
index fac02e2a6..81a0281b7 100644
--- a/tests/unit/button/deprecated.js
+++ b/tests/unit/button/deprecated.js
@@ -1,134 +1,135 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/button"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "Button (deprecated): core" );
+QUnit.module( "Button (deprecated): core" );
-test( "Calling button on a checkbox input calls checkboxradio widget", function() {
+QUnit.test( "Calling button on a checkbox input calls checkboxradio widget", function( assert ) {
var checkbox = $( "#checkbox01" );
- expect( 2 );
+ assert.expect( 2 );
checkbox.button();
- ok( !!checkbox.checkboxradio( "instance" ),
+ assert.ok( !!checkbox.checkboxradio( "instance" ),
"Calling button on a checkbox creates checkboxradio instance" );
- ok( !checkbox.checkboxradio( "option", "icon" ),
+ assert.ok( !checkbox.checkboxradio( "option", "icon" ),
"Calling button on a checkbox sets the checkboxradio icon option to false" );
} );
-test( "Calling buttonset calls controlgroup", function() {
+QUnit.test( "Calling buttonset calls controlgroup", function( assert ) {
var controlgroup = $( ".buttonset" );
- expect( 1 );
+ assert.expect( 1 );
controlgroup.buttonset();
- ok( controlgroup.is( ":ui-controlgroup" ), "Calling buttonset creates controlgroup instance" );
+ assert.ok( controlgroup.is( ":ui-controlgroup" ), "Calling buttonset creates controlgroup instance" );
} );
-module( "Button (deprecated): methods" );
+QUnit.module( "Button (deprecated): methods" );
-test( "destroy", function( assert ) {
- expect( 1 );
+QUnit.test( "destroy", function( assert ) {
+ assert.expect( 1 );
assert.domEqual( "#checkbox02", function() {
$( "#checkbox02" ).button().button( "destroy" );
} );
} );
-test( "refresh: Ensure disabled state is preserved correctly.", function() {
- expect( 5 );
+QUnit.test( "refresh: Ensure disabled state is preserved correctly.", function( assert ) {
+ assert.expect( 5 );
var element = null;
element = $( "#checkbox02" );
element.button( { disabled: true } ).button( "refresh" );
- ok( element.button( "option", "disabled" ), "Checkboxes should remain disabled after refresh" );
- ok( element.prop( "disabled" ), "Input remains disabled after refresh" );
+ assert.ok( element.button( "option", "disabled" ), "Checkboxes should remain disabled after refresh" );
+ assert.ok( element.prop( "disabled" ), "Input remains disabled after refresh" );
element = $( "#radio02" );
element.button( { disabled: true } ).button( "refresh" );
- ok( element.button( "option", "disabled" ), "Radio buttons should remain disabled after refresh" );
+ assert.ok( element.button( "option", "disabled" ), "Radio buttons should remain disabled after refresh" );
element = $( "#checkbox02" );
element.button( { disabled: true } ).prop( "disabled", false ).button( "refresh" );
- ok( !element.button( "option", "disabled" ), "Changing a checkbox's disabled property should update the state after refresh." );
+ assert.ok( !element.button( "option", "disabled" ), "Changing a checkbox's disabled property should update the state after refresh." );
element = $( "#radio02" );
element.button( { disabled: true } ).prop( "disabled", false ).button( "refresh" );
- ok( !element.button( "option", "disabled" ), "Changing a radio button's disabled property should update the state after refresh." );
+ assert.ok( !element.button( "option", "disabled" ), "Changing a radio button's disabled property should update the state after refresh." );
} );
-module( "button (deprecated): options" );
+QUnit.module( "button (deprecated): options" );
-test( "Setting items option on buttonset sets the button properties on the items option", function() {
- expect( 2 );
+QUnit.test( "Setting items option on buttonset sets the button properties on the items option", function( assert ) {
+ assert.expect( 2 );
var controlgroup = $( ".buttonset" );
controlgroup.buttonset( { items: "bar" } );
- equal( controlgroup.controlgroup( "option", "items.button" ), "bar",
+ assert.equal( controlgroup.controlgroup( "option", "items.button" ), "bar",
"items.button set when setting items option on init on buttonset" );
controlgroup.buttonset( "option", "items", "foo" );
- equal( controlgroup.controlgroup( "option", "items.button" ), "foo",
+ assert.equal( controlgroup.controlgroup( "option", "items.button" ), "foo",
"items.button set when setting items option on buttonset" );
} );
-test( "disabled, null", function() {
- expect( 2 );
+QUnit.test( "disabled, null", function( assert ) {
+ assert.expect( 2 );
$( "#radio02" ).prop( "disabled", true ).button( { disabled: null } );
- deepEqual( $( "#radio02" ).button( "option", "disabled" ), true,
+ assert.deepEqual( $( "#radio02" ).button( "option", "disabled" ), true,
"disabled option set to true" );
- deepEqual( true, $( "#radio02" ).prop( "disabled" ), "element is not disabled" );
+ assert.deepEqual( true, $( "#radio02" ).prop( "disabled" ), "element is not disabled" );
} );
-test( "text / showLabel options proxied", function() {
- expect( 8 );
+QUnit.test( "text / showLabel options proxied", function( assert ) {
+ assert.expect( 8 );
var button = $( "#button" );
button.button( {
text: false,
icon: "ui-icon-gear"
} );
- equal( button.button( "option", "showLabel" ), false,
+ assert.equal( button.button( "option", "showLabel" ), false,
"Setting the text option to false sets the showLabel option to false on init" );
button.button( "option", "showLabel", true );
- equal( button.button( "option", "text" ), true,
+ assert.equal( button.button( "option", "text" ), true,
"Setting showLabel true with option method sets text option to true" );
button.button( "option", "text", false );
- equal( button.button( "option", "showLabel" ), false,
+ assert.equal( button.button( "option", "showLabel" ), false,
"Setting text false with option method sets showLabel option to false" );
button.button( "option", "text", true );
- equal( button.button( "option", "showLabel" ), true,
+ assert.equal( button.button( "option", "showLabel" ), true,
"Setting text true with option method sets showLabel option to true" );
button.button( "option", "showLabel", false );
- equal( button.button( "option", "text" ), false,
+ assert.equal( button.button( "option", "text" ), false,
"Setting showLabel false with option method sets text option to false" );
button.button( "destroy" );
button.button( {
text: true,
icon: "ui-icon-gear"
} );
- equal( button.button( "option", "showLabel" ), true,
+ assert.equal( button.button( "option", "showLabel" ), true,
"Setting the text option to true sets the showLabel option to true on init" );
button.button( "destroy" );
button.button( {
showLabel: true,
icon: "ui-icon-gear"
} );
- equal( button.button( "option", "text" ), true,
+ assert.equal( button.button( "option", "text" ), true,
"Setting the showLabel option to true sets the text option to true on init" );
button.button( "destroy" );
button.button( {
showLabel: false,
icon: "ui-icon-gear"
} );
- equal( button.button( "option", "text" ), false,
+ assert.equal( button.button( "option", "text" ), false,
"Setting the showLabel option to false sets the text option to false on init" );
} );
-test( "icon / icons options properly proxied", function() {
- expect( 10 );
+QUnit.test( "icon / icons options properly proxied", function( assert ) {
+ assert.expect( 10 );
var button = $( "#button" );
@@ -136,14 +137,14 @@ test( "icon / icons options properly proxied", function() {
icon: "foo"
} );
- equal( button.button( "option", "icons.primary" ), "foo",
+ assert.equal( button.button( "option", "icons.primary" ), "foo",
"Icon option properly proxied on init" );
button.button( {
icon: "bar"
} );
- equal( button.button( "option", "icons.primary" ), "bar",
+ assert.equal( button.button( "option", "icons.primary" ), "bar",
"Icon option properly proxied with option method" );
button.button( {
@@ -152,9 +153,9 @@ test( "icon / icons options properly proxied", function() {
}
} );
- equal( button.button( "option", "icon" ), "foo",
+ assert.equal( button.button( "option", "icon" ), "foo",
"Icons primary option properly proxied with option method" );
- equal( button.button( "option", "iconPosition" ), "beginning",
+ assert.equal( button.button( "option", "iconPosition" ), "beginning",
"Icons primary option sets iconPosition option to beginning" );
button.button( {
@@ -163,9 +164,9 @@ test( "icon / icons options properly proxied", function() {
}
} );
- equal( button.button( "option", "icon" ), "bar",
+ assert.equal( button.button( "option", "icon" ), "bar",
"Icons secondary option properly proxied with option method" );
- equal( button.button( "option", "iconPosition" ), "end",
+ assert.equal( button.button( "option", "iconPosition" ), "end",
"Icons secondary option sets iconPosition option to end" );
button.button( "destroy" );
@@ -176,9 +177,9 @@ test( "icon / icons options properly proxied", function() {
}
} );
- equal( button.button( "option", "icon" ), "foo",
+ assert.equal( button.button( "option", "icon" ), "foo",
"Icons primary option properly proxied on init" );
- equal( button.button( "option", "iconPosition" ), "beginning",
+ assert.equal( button.button( "option", "iconPosition" ), "beginning",
"Icons primary option sets iconPosition option to beginning on init" );
button.button( {
@@ -187,9 +188,9 @@ test( "icon / icons options properly proxied", function() {
}
} );
- equal( button.button( "option", "icon" ), "bar",
+ assert.equal( button.button( "option", "icon" ), "bar",
"Icons secondary option properly proxied on init" );
- equal( button.button( "option", "iconPosition" ), "end",
+ assert.equal( button.button( "option", "iconPosition" ), "end",
"Icons secondary option sets iconPosition option to end on init" );
} );