aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/checkboxradio/checkboxradio.html7
-rw-r--r--tests/unit/checkboxradio/core.js19
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/checkboxradio/checkboxradio.html b/tests/unit/checkboxradio/checkboxradio.html
index 92db788c5..9883e0834 100644
--- a/tests/unit/checkboxradio/checkboxradio.html
+++ b/tests/unit/checkboxradio/checkboxradio.html
@@ -64,6 +64,13 @@
<label>
<input type="checkbox" id="label-with-no-for"/>
</label>
+
+<form id="form3"></form>
+<input type="radio" name="crazy-form" id="crazy-form-1" form="form3" checked="checked">
+<label for="crazy-form-1">Choice 1</label>
+<input type="radio" name="crazy-form" id="crazy-form-2" form="form3">
+<label for="crazy-form-2">Choice 2</label>
+
</div>
</body>
</html>
diff --git a/tests/unit/checkboxradio/core.js b/tests/unit/checkboxradio/core.js
index 15cfc155b..2a9cf9822 100644
--- a/tests/unit/checkboxradio/core.js
+++ b/tests/unit/checkboxradio/core.js
@@ -49,6 +49,25 @@ asyncTest( "Ensure checked after single click on checkbox label button", functio
} );
} );
+test( "Handle form association via form attribute", function( assert ) {
+ expect( 4 );
+
+ var radio1 = $( "#crazy-form-1" ).checkboxradio();
+ var radio1Label = radio1.checkboxradio( "widget" );
+ var radio2 = $( "#crazy-form-2" ).checkboxradio();
+ var radio2Label = radio2.checkboxradio( "widget" );
+
+ radio2.change( function() {
+ ok( this.checked, "#2 checked" );
+ ok( !radio1[ 0 ].checked, "#1 not checked" );
+
+ assert.hasClasses( radio2Label, "ui-state-active" );
+ assert.lacksClasses( radio1Label, "ui-state-active" );
+ } );
+
+ radio2Label.simulate( "click" );
+} );
+
test( "Checkbox creation requires a label, and finds it in all cases", function( assert ) {
expect( 7 );
var groups = [