aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/accordion/accordion_methods.js7
-rw-r--r--tests/unit/autocomplete/autocomplete_options.js11
-rw-r--r--tests/unit/button/button_options.js29
-rw-r--r--tests/unit/dialog/dialog_methods.js4
-rw-r--r--tests/unit/draggable/draggable_methods.js14
-rw-r--r--tests/unit/droppable/droppable_methods.js29
-rw-r--r--tests/unit/progressbar/progressbar_methods.js10
-rw-r--r--tests/unit/resizable/resizable_methods.js17
-rw-r--r--tests/unit/selectable/selectable_methods.js36
-rw-r--r--tests/unit/slider/slider_methods.js3
-rw-r--r--tests/unit/sortable/sortable_methods.js35
-rw-r--r--tests/unit/spinner/spinner_methods.js4
-rw-r--r--tests/unit/tabs/tabs_options.js18
-rw-r--r--tests/unit/tooltip/tooltip_methods.js7
14 files changed, 149 insertions, 75 deletions
diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js
index b1123b828..7612479f7 100644
--- a/tests/unit/accordion/accordion_methods.js
+++ b/tests/unit/accordion/accordion_methods.js
@@ -14,10 +14,15 @@ test( "destroy", function() {
});
test( "enable/disable", function() {
- expect( 4 );
+ expect( 7 );
var element = $( "#list1" ).accordion();
state( element, 1, 0, 0 );
element.accordion( "disable" );
+
+ ok( element.hasClass( "ui-state-disabled" ), "element gets ui-state-disabled" );
+ equal( element.attr( "aria-disabled" ), "true", "element gets aria-disabled" );
+ ok( element.hasClass( "ui-accordion-disabled" ), "element gets ui-accordion-disabled" );
+
// event does nothing
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" );
state( element, 1, 0, 0 );
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index 9f0bd2d43..c98f2c28e 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/tests/unit/autocomplete/autocomplete_options.js
@@ -88,17 +88,20 @@ asyncTest( "delay", function() {
});
asyncTest( "disabled", function() {
- expect( 2 );
+ expect( 5 );
var element = $( "#autocomplete" ).autocomplete({
source: data,
- delay: 0,
- disabled: true
+ delay: 0
}),
- menu = element.autocomplete( "widget" );
+ menu = element.autocomplete( "disable" ).autocomplete( "widget" );
element.val( "ja" ).keydown();
ok( menu.is( ":hidden" ) );
+ ok( !element.is( ".ui-state-disabled" ), "element doesn't get ui-state-disabled" );
+ ok( !element.attr( "aria-disabled" ), "element doesn't get aria-disabled" );
+ ok( menu.is( ".ui-autocomplete-disabled" ), "element gets ui-autocomplete-disabled" );
+
setTimeout(function() {
ok( menu.is( ":hidden" ) );
start();
diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js
index e1931a54e..124a8699f 100644
--- a/tests/unit/button/button_options.js
+++ b/tests/unit/button/button_options.js
@@ -3,19 +3,26 @@
*/
(function($) {
-module("button: options");
+module( "button: options" );
-test("disabled, explicit value", function() {
- expect( 4 );
- $("#radio01").button({ disabled: false });
- deepEqual(false, $("#radio01").button("option", "disabled"),
- "disabled option set to false");
- deepEqual(false, $("#radio01").prop("disabled"), "element is disabled");
+test( "disabled, explicit value", function() {
+ expect( 9 );
- $("#radio02").button({ disabled: true });
- deepEqual(true, $("#radio02").button("option", "disabled"),
- "disabled option set to true");
- deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled");
+ var element = $( "#radio01" ).button({ disabled: false });
+ deepEqual( element.button( "option", "disabled" ), false, "disabled option set to false" );
+ deepEqual( element.prop( "disabled" ), false, "element is disabled" );
+
+ ok( !element.button( "widget" ).hasClass( "ui-state-disabled" ), "element gets ui-state-disabled" );
+ ok( !element.button( "widget" ).hasClass( "ui-button-disabled" ), "element gets ui-button-disabled" );
+
+ element = $( "#radio02" ).button({ disabled: true });
+
+ ok( element.button( "widget" ).hasClass( "ui-state-disabled" ), "element gets ui-state-disabled" );
+ ok( !element.button( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.button( "widget" ).hasClass( "ui-button-disabled" ), "element gets ui-button-disabled" );
+
+ deepEqual( element.button( "option", "disabled" ), true, "disabled option set to true" );
+ deepEqual( element.prop( "disabled" ), true, "element is not disabled" );
});
test("disabled, null", function() {
diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js
index 6de185513..2bb06ab46 100644
--- a/tests/unit/dialog/dialog_methods.js
+++ b/tests/unit/dialog/dialog_methods.js
@@ -101,11 +101,13 @@ test("#4980: Destroy should place element back in original DOM position", functi
});
test( "enable/disable disabled", function() {
- expect( 2 );
+ expect( 4 );
var element = $( "<div></div>" ).dialog();
element.dialog( "disable" );
equal(element.dialog( "option", "disabled" ), false, "disable method doesn't do anything" );
ok( !element.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" );
+ ok( !element.dialog( "widget" ).hasClass( "ui-state-disabled" ), "disable method doesn't add ui-state-disabled class" );
+ ok( !element.dialog( "widget" ).attr( "aria-disabled" ), "disable method doesn't add aria-disabled" );
});
test("close", function() {
diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js
index 901c261d6..63a19e26d 100644
--- a/tests/unit/draggable/draggable_methods.js
+++ b/tests/unit/draggable/draggable_methods.js
@@ -74,16 +74,16 @@ test( "enable", function() {
});
test( "disable", function() {
- expect( 7 );
+ expect( 10 );
- element = $("#draggable2").draggable({ disabled: false });
+ element = $( "#draggable2" ).draggable({ disabled: false });
TestHelpers.draggable.shouldMove( element, ".draggable({ disabled: false })" );
- element.draggable("disable");
+ element.draggable( "disable" );
TestHelpers.draggable.shouldNotMove( element, ".draggable('disable')" );
equal( element.draggable( "option", "disabled" ), true, "disabled option getter" );
- element.draggable("destroy");
+ element.draggable( "destroy" );
element.draggable({ disabled: false });
TestHelpers.draggable.shouldMove( element, ".draggable({ disabled: false })" );
@@ -91,8 +91,12 @@ test( "disable", function() {
equal( element.draggable( "option", "disabled" ), true, "disabled option setter" );
TestHelpers.draggable.shouldNotMove( element, ".draggable('option', 'disabled', true)" );
+ ok( !element.draggable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ ok( !element.draggable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.draggable( "widget" ).hasClass( "ui-draggable-disabled" ), "element gets ui-draggable-disabled" );
+
var expected = element.draggable(),
- actual = expected.draggable("disable");
+ actual = expected.draggable( "disable" );
equal( actual, expected, "disable is chainable" );
});
diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js
index 2b452a63d..f7682d262 100644
--- a/tests/unit/droppable/droppable_methods.js
+++ b/tests/unit/droppable/droppable_methods.js
@@ -63,26 +63,29 @@ test("enable", function() {
equal(actual, expected, "enable is chainable");
});
-test("disable", function() {
- expect(7);
+test( "disable", function() {
+ expect( 10 );
- var el, actual, expected;
+ var actual, expected,
+ element = $( "#droppable1" ).droppable({ disabled: false });
- el = $("#droppable1").droppable({ disabled: false });
TestHelpers.droppable.shouldDrop();
- el.droppable("disable");
+ element.droppable( "disable" );
TestHelpers.droppable.shouldNotDrop();
- equal(el.droppable("option", "disabled"), true, "disabled option getter");
- el.droppable("destroy");
- el.droppable({ disabled: false });
+ equal( element.droppable( "option", "disabled" ), true, "disabled option getter" );
+ element.droppable( "destroy" );
+ element.droppable({ disabled: false });
TestHelpers.droppable.shouldDrop();
- el.droppable("option", "disabled", true);
- equal(el.droppable("option", "disabled"), true, "disabled option setter");
+ element.droppable( "option", "disabled", true );
+ ok( !element.droppable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ ok( !element.droppable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.droppable( "widget" ).hasClass( "ui-droppable-disabled" ), "element gets ui-droppable-disabled" );
+ equal( element.droppable( "option", "disabled" ), true, "disabled option setter" );
TestHelpers.droppable.shouldNotDrop();
- expected = $("<div></div>").droppable(),
- actual = expected.droppable("disable");
- equal(actual, expected, "disable is chainable");
+ expected = $( "<div></div>" ).droppable();
+ actual = expected.droppable( "disable" );
+ equal( actual, expected, "disable is chainable" );
});
})(jQuery);
diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js
index cf7faf6af..004eacf90 100644
--- a/tests/unit/progressbar/progressbar_methods.js
+++ b/tests/unit/progressbar/progressbar_methods.js
@@ -7,6 +7,16 @@ test( "destroy", function() {
});
});
+test( "disable", function() {
+ expect( 3 );
+
+ var element = $( "#progressbar" ).progressbar().progressbar( "disable" );
+
+ ok( element.progressbar( "widget" ).hasClass( "ui-state-disabled" ), "element gets ui-state-disabled" );
+ ok( element.progressbar( "widget" ).attr( "aria-disabled" ), "element gets aria-disabled" );
+ ok( element.progressbar( "widget" ).hasClass( "ui-progressbar-disabled" ), "element gets ui-progressbar-disabled" );
+});
+
test( "value", function() {
expect( 3 );
diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js
index b12f3035a..abb8951f9 100644
--- a/tests/unit/resizable/resizable_methods.js
+++ b/tests/unit/resizable/resizable_methods.js
@@ -3,10 +3,19 @@
*/
(function($) {
-module("resizable: methods");
+module( "resizable: methods" );
-// this is here to make JSHint pass "unused", and we don't want to
-// remove the parameter for when we finally implement
-$.noop();
+test( "disable", function() {
+ expect( 5 );
+
+ var element = $( "#resizable1" ).resizable({ disabled: false }),
+ chainable = element.resizable( "disable" );
+
+ ok( !element.resizable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ ok( !element.resizable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.resizable( "widget" ).hasClass( "ui-resizable-disabled" ), "element gets ui-resizable-disabled" );
+ equal( element.resizable( "option", "disabled" ), true, "disabled option setter" );
+ equal( chainable, element, "disable is chainable" );
+});
})(jQuery);
diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js
index 72f9bb28d..179d4ecd6 100644
--- a/tests/unit/selectable/selectable_methods.js
+++ b/tests/unit/selectable/selectable_methods.js
@@ -71,34 +71,40 @@ test("enable", function() {
equal(actual, expected, "enable is chainable");
});
-test("disable", function() {
- expect(3);
- var expected, actual,
+test( "disable", function() {
+ expect( 6 );
+ var chainable,
fired = false,
- el = $("#selectable1");
+ element = $( "#selectable1" );
- el.selectable({
+ element.selectable({
disabled: false,
- start: function() { fired = true; }
+ start: function() {
+ fired = true;
+ }
});
- el.simulate( "drag", {
+ element.simulate( "drag", {
dx: 20,
dy: 20
});
- equal(fired, true, "start fired");
- el.selectable("disable");
+ equal( fired, true, "start fired" );
+
+ chainable = element.selectable( "disable" );
fired = false;
- el.simulate( "drag", {
+ element.simulate( "drag", {
dx: 20,
dy: 20
});
- equal(fired, false, "start fired");
- el.selectable("destroy");
+ equal( fired, false, "start fired" );
- expected = $("<div></div>").selectable();
- actual = expected.selectable("disable");
- equal(actual, expected, "disable is chainable");
+ ok( !element.selectable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ ok( !element.selectable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.selectable( "widget" ).hasClass( "ui-selectable-disabled" ), "element gets ui-selectable-disabled" );
+
+ element.selectable( "destroy" );
+
+ equal( chainable, element, "disable is chainable" );
});
})(jQuery);
diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js
index 75df230a6..bd9023133 100644
--- a/tests/unit/slider/slider_methods.js
+++ b/tests/unit/slider/slider_methods.js
@@ -49,7 +49,7 @@ test( "enable", function() {
});
test( "disable", function() {
- expect( 5 );
+ expect( 6 );
var element,
expected = $( "<div></div>" ).slider(),
actual = expected.slider( "disable" );
@@ -61,6 +61,7 @@ test( "disable", function() {
element.slider( "disable" );
ok( element.hasClass( "ui-state-disabled" ), "slider has ui-state-disabled class after disable method call" );
ok( element.hasClass( "ui-slider-disabled" ), "slider has ui-slider-disabled class after disable method call" );
+ ok( !element.attr( "aria-disabled" ), "slider does not have aria-disabled attr after disable method call" );
});
test( "value", function() {
diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js
index 07a7bc77d..f3fe240e7 100644
--- a/tests/unit/sortable/sortable_methods.js
+++ b/tests/unit/sortable/sortable_methods.js
@@ -64,29 +64,30 @@ test("enable", function() {
equal(actual, expected, "enable is chainable");
});
-test("disable", function() {
- expect(7);
+test( "disable", function() {
+ expect( 9 );
- var el, actual, expected;
+ var chainable,
+ element = $( "#sortable" ).sortable({ disabled: false });
- el = $("#sortable").sortable({ disabled: false });
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })");
+ TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
- el.sortable("disable");
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, "disabled.sortable getter");
+ chainable = element.sortable( "disable" );
+ TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 0, "disabled.sortable getter" );
- el.sortable("destroy");
+ element.sortable( "destroy" );
- el.sortable({ disabled: false });
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 2, ".sortable({ disabled: false })");
- el.sortable("option", "disabled", true);
- equal(el.sortable("option", "disabled"), true, "disabled option setter");
- ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction");
- TestHelpers.sortable.sort($("li", el)[0], 0, 44, 0, ".sortable('option', 'disabled', true)");
+ element.sortable({ disabled: false });
+ TestHelpers.sortable.sort( $( "li", element )[ 0 ], 0, 44, 2, ".sortable({ disabled: false })" );
+ element.sortable( "option", "disabled", true);
+ equal( element.sortable( "option", "disabled" ), true, "disabled option setter" );
- expected = $("<div></div>").sortable(),
- actual = expected.sortable("disable");
- equal(actual, expected, "disable is chainable");
+ ok( !element.sortable( "widget" ).hasClass( "ui-state-disabled" ), "element does not get ui-state-disabled" );
+ ok( !element.sortable( "widget" ).attr( "aria-disabled" ), "element does not get aria-disabled" );
+ ok( element.sortable( "widget" ).hasClass( "ui-sortable-disabled" ), "element gets ui-sortable-disabled" );
+
+ TestHelpers.sortable.sort($( "li", element )[ 0 ], 0, 44, 0, ".sortable('option', 'disabled', true)" );
+ equal( chainable, element, "disable is chainable" );
});
})(jQuery);
diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js
index af872f257..4f44a73ae 100644
--- a/tests/unit/spinner/spinner_methods.js
+++ b/tests/unit/spinner/spinner_methods.js
@@ -12,7 +12,7 @@ test( "destroy", function() {
});
test( "disable", function() {
- expect( 14 );
+ expect( 16 );
var element = $( "#spin" ).val( 2 ).spinner(),
wrapper = $( "#spin" ).spinner( "widget" );
@@ -21,6 +21,8 @@ test( "disable", function() {
element.spinner( "disable" );
ok( wrapper.hasClass( "ui-spinner-disabled" ), "after: wrapper has ui-spinner-disabled class" );
+ ok( wrapper.hasClass( "ui-state-disabled" ), "after: wrapper has ui-state-disabled class" );
+ ok( !wrapper.attr( "aria-disabled" ), "after: wrapper does not have aria-disabled attr" );
ok( element.is( ":disabled"), "after: input has disabled attribute" );
simulateKeyDownUp( element, $.ui.keyCode.UP );
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index c78c42b58..02a2fea34 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -144,24 +144,40 @@ test( "{ collapsible: true }", function() {
});
test( "disabled", function() {
- expect( 10 );
+ expect( 22 );
// fully enabled by default
var element = $( "#tabs1" ).tabs();
disabled( element, false );
+ ok( !element.tabs( "widget" ).hasClass( "ui-state-disabled" ), "after: wrapper doesn't have ui-state-disabled class" );
+ ok( !element.tabs( "widget" ).hasClass( "ui-tabs-disabled" ), "after: wrapper doesn't have ui-tabs-disabled class" );
+ ok( !element.tabs( "widget" ).attr( "aria-disabled" ), "after: wrapper doesn't have aria-disabled attr" );
+
// disable single tab
element.tabs( "option", "disabled", [ 1 ] );
disabled( element, [ 1 ] );
+ ok( !element.tabs( "widget" ).hasClass( "ui-state-disabled" ), "after: wrapper doesn't have ui-state-disabled class" );
+ ok( !element.tabs( "widget" ).hasClass( "ui-tabs-disabled" ), "after: wrapper doesn't have ui-tabs-disabled class" );
+ ok( !element.tabs( "widget" ).attr( "aria-disabled" ), "after: wrapper doesn't have aria-disabled attr" );
+
// disabled active tab
element.tabs( "option", "disabled", [ 0, 1 ] );
disabled( element, [ 0, 1 ] );
+ ok( !element.tabs( "widget" ).hasClass( "ui-state-disabled" ), "after: wrapper doesn't have ui-state-disabled class" );
+ ok( !element.tabs( "widget" ).hasClass( "ui-tabs-disabled" ), "after: wrapper doesn't have ui-tabs-disabled class" );
+ ok( !element.tabs( "widget" ).attr( "aria-disabled" ), "after: wrapper doesn't have aria-disabled attr" );
+
// disable all tabs
element.tabs( "option", "disabled", [ 0, 1, 2 ] );
disabled( element, true );
+ ok( !element.tabs( "widget" ).hasClass( "ui-state-disabled" ), "after: wrapper doesn't have ui-state-disabled class" );
+ ok( !element.tabs( "widget" ).hasClass( "ui-tabs-disabled" ), "after: wrapper doesn't have ui-tabs-disabled class" );
+ ok( !element.tabs( "widget" ).attr( "aria-disabled" ), "after: wrapper doesn't have aria-disabled attr" );
+
// enable all tabs
element.tabs( "option", "disabled", [] );
disabled( element, false );
diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js
index c846d216c..a557ff943 100644
--- a/tests/unit/tooltip/tooltip_methods.js
+++ b/tests/unit/tooltip/tooltip_methods.js
@@ -54,7 +54,7 @@ test( "open/close with tracking", function() {
});
test( "enable/disable", function() {
- expect( 7 );
+ expect( 10 );
$.fx.off = true;
var tooltip,
element = $( "#tooltipped1" ).tooltip();
@@ -66,6 +66,11 @@ test( "enable/disable", function() {
element.tooltip( "disable" );
equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
+
+ ok( !element.tooltip( "widget" ).hasClass( "ui-state-disabled" ), "element doesn't get ui-state-disabled" );
+ ok( !element.tooltip( "widget" ).attr( "aria-disabled" ), "element doesn't get aria-disabled" );
+ ok( !element.tooltip( "widget" ).hasClass( "ui-tooltip-disabled" ), "element doesn't get ui-tooltip-disabled" );
+
// support: jQuery <1.6.2
// support: IE <8
// We should use strictEqual( ..., undefined ) when dropping jQuery 1.6.1 support (or IE6/7)