aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button/button_core.js
diff options
context:
space:
mode:
authorTJ VanToll <tj.vantoll@gmail.com>2013-04-07 12:57:15 -0400
committerTJ VanToll <tj.vantoll@gmail.com>2013-04-09 22:45:46 -0400
commit2de31fdbf498a6c20d196a96d007ea0f069644c5 (patch)
treec8d4e5212bf800f537daa35382cf0a42a5b12c50 /tests/unit/button/button_core.js
parent5b9e6a44d8b7c3b1c67e71b448951153bec15c95 (diff)
downloadjquery-ui-2de31fdbf498a6c20d196a96d007ea0f069644c5.tar.gz
jquery-ui-2de31fdbf498a6c20d196a96d007ea0f069644c5.zip
Button: On form reset only call refresh on current button widgets. Fixed #9213: Button: timeout in formResetHandler causing refresh to be called on non-widgets
Diffstat (limited to 'tests/unit/button/button_core.js')
-rw-r--r--tests/unit/button/button_core.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index dbc079818..16c7ca450 100644
--- a/tests/unit/button/button_core.js
+++ b/tests/unit/button/button_core.js
@@ -153,6 +153,30 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function
ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
});
+asyncTest( "Resetting a button's form should refresh the visual state of the button widget to match.", function() {
+ expect( 2 );
+ var form = $( "<form>" +
+ "<button></button>" +
+ "<label for='c1'></label><input id='c1' type='checkbox' checked>" +
+ "</form>" ),
+ button = form.find( "button" ).button(),
+ checkbox = form.find( "input[type=checkbox]" ).button();
+
+ checkbox.prop( "checked", false ).button( "refresh" );
+ ok( !checkbox.button( "widget" ).hasClass( "ui-state-active" ) );
+
+ form.get( 0 ).reset();
+
+ // #9213: If a button has been removed, refresh should not be called on it when
+ // its corresponding form is reset.
+ button.remove();
+
+ setTimeout(function() {
+ ok( checkbox.button( "widget" ).hasClass( "ui-state-active" ));
+ start();
+ });
+});
+
asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
expect( 2 );
var check = $( "#check" ).button(),