aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-04-21 15:10:38 +0200
committerFelix Nagel <info@felixnagel.com>2013-04-21 15:10:38 +0200
commit4efd006e26a6cdc3bf78832c0a0832e7301c841b (patch)
tree5263fe72e9a2784410632d2dee56efd4e58b83f2 /tests/unit/button
parent73c7342bc4418a902bf021c89e7d2c43172e004e (diff)
parent71a332e8b83a1657521e04388f5592997e81bbcc (diff)
downloadjquery-ui-4efd006e26a6cdc3bf78832c0a0832e7301c841b.tar.gz
jquery-ui-4efd006e26a6cdc3bf78832c0a0832e7301c841b.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests/unit/button')
-rw-r--r--tests/unit/button/button.html2
-rw-r--r--tests/unit/button/button_core.js37
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html
index eeb568686..223581ef7 100644
--- a/tests/unit/button/button.html
+++ b/tests/unit/button/button.html
@@ -71,6 +71,8 @@
<div><input id="submit" type="submit" value="Label"></div>
+<button id="button1">Button</button>
+
</div>
</body>
</html>
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index dbc079818..6df7da9db 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(),
@@ -172,4 +196,17 @@ test( "#7534 - Button label selector works for ids with \":\"", function() {
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
});
+asyncTest( "#9169 - Disabled button maintains ui-state-focus", function() {
+ expect( 2 );
+ var element = $( "#button1" ).button();
+ element[ 0 ].focus();
+ setTimeout(function() {
+ ok( element.hasClass( "ui-state-focus" ), "button has ui-state-focus" );
+ element.button( "disable" );
+ ok( !element.hasClass( "ui-state-focus" ),
+ "button does not have ui-state-focus when disabled" );
+ start();
+ });
+});
+
})(jQuery);