aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/controlgroup/methods.js
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2016-05-11 11:49:37 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2016-05-26 09:15:48 -0400
commit81a8e30c07a3663728c98b15775b5580fa806cdd (patch)
tree974431ea32be4c49f07fd1db59f65a77b6467e63 /tests/unit/controlgroup/methods.js
parent04b670e6cc6b25ffe595c665ea86929f71f78b50 (diff)
downloadjquery-ui-81a8e30c07a3663728c98b15775b5580fa806cdd.tar.gz
jquery-ui-81a8e30c07a3663728c98b15775b5580fa806cdd.zip
Controlgroup: Fix issues with compatibility with spinner
Fixes #14966
Diffstat (limited to 'tests/unit/controlgroup/methods.js')
-rw-r--r--tests/unit/controlgroup/methods.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/unit/controlgroup/methods.js b/tests/unit/controlgroup/methods.js
index 9f1e4201e..a9d781f2e 100644
--- a/tests/unit/controlgroup/methods.js
+++ b/tests/unit/controlgroup/methods.js
@@ -4,7 +4,8 @@ define( [
"ui/widgets/controlgroup",
"ui/widgets/checkboxradio",
"ui/widgets/selectmenu",
- "ui/widgets/button"
+ "ui/widgets/button",
+ "ui/widgets/spinner"
], function( QUnit, $ ) {
QUnit.module( "Controlgroup: methods" );
@@ -13,6 +14,7 @@ QUnit.test( "destroy", function( assert ) {
assert.expect( 1 );
assert.domEqual( ".controlgroup", function() {
$( ".controlgroup" ).controlgroup().controlgroup( "destroy" );
+ $( "#spinner" ).addClass( "ui-spinner-input" );
} );
} );
@@ -21,7 +23,7 @@ QUnit.test( "disable", function( assert ) {
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" );
- assert.strictEqual( element.find( ".ui-state-disabled" ).length, 6,
+ assert.strictEqual( element.find( ".ui-state-disabled" ).length, 9,
"Child widgets are disabled" );
} );
@@ -37,7 +39,8 @@ QUnit.test( "enable", function( assert ) {
var tests = {
"checkboxradio": "<input type='checkbox'>",
"selectmenu": "<select><option>foo</option></select>",
- "button": "<button>button text</button>"
+ "button": "<button>button text</button>",
+ "spinner": "<input class='ui-spinner-input'>"
},
orientations = {
"horizontal": [
@@ -63,7 +66,7 @@ $.each( tests, function( widget, html ) {
QUnit.test( "refresh: " + widget + ": " + name, function( assert ) {
assert.expect( 41 );
- var i, control, currentClasses,
+ var i, control, label, currentClasses,
controls = [],
element = $( "<div>" ).controlgroup( {
direction: name
@@ -109,11 +112,11 @@ $.each( tests, function( widget, html ) {
// Add a label for each element and then append the element to the control group
for ( i = 0; i < 4; i++ ) {
- control = $( html ).attr( "id", "id" + i )
- .add( $( "<label>label text</label>" ).clone().attr( "for", "id" + i ) );
+ control = $( html ).attr( "id", "id" + i );
+ label = $( "<label>label text</label>" ).attr( "for", "id" + i );
controls.push( control );
- element.append( control );
+ element.append( control, label );
}
// Refresh the controlgroup now that its populated
@@ -136,6 +139,9 @@ $.each( tests, function( widget, html ) {
iterateHidden();
// Disable the first control
+ if ( widget === "spinner" ) {
+ controls[ 0 ].spinner( "disable" );
+ }
controls[ 0 ].prop( "disabled", true );
element.controlgroup( "refresh" );
@@ -155,7 +161,7 @@ QUnit.test( "Child Classes Option: init", function( assert ) {
"ui-selectmenu-button-closed": "test-class"
}
} );
- var controlgroup = $( ".controlgroup-pre" ).controlgroup();
+ $( ".controlgroup-pre" ).controlgroup();
assert.hasClasses( selectmenu.selectmenu( "widget" ), "test-class" );
} );