mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-03 20:34:42 +00:00
test that clicks bound to labeled checkbox input are fired by label clicks
This commit is contained in:
parent
4daed58a16
commit
6549b42ab5
2 changed files with 28 additions and 0 deletions
|
|
@ -121,4 +121,25 @@
|
|||
test( "checkboxradio elements in the keepNative set shouldn't be enhanced", function() {
|
||||
ok( !$("input.should-be-native").parent().is("div.ui-checkbox") );
|
||||
});
|
||||
|
||||
asyncTest( "clicking the label triggers a click on the element", function() {
|
||||
var clicked = false;
|
||||
|
||||
expect( 1 );
|
||||
|
||||
$( "#checkbox-click-triggered" ).one('click', function() {
|
||||
clicked = true;
|
||||
});
|
||||
|
||||
$.testHelper.sequence([
|
||||
function() {
|
||||
$( "[for='checkbox-click-triggered']" ).click();
|
||||
},
|
||||
|
||||
function() {
|
||||
ok(clicked, "click was fired on input");
|
||||
start();
|
||||
}
|
||||
], 2000);
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
|||
|
|
@ -83,6 +83,13 @@
|
|||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div data-role="fieldcontain">
|
||||
<fieldset data-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-click-triggered" id="checkbox-click-triggered"/>
|
||||
<label for="checkbox-click-triggered">click triggered</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="enhancetest">
|
||||
|
|
|
|||
Loading…
Reference in a new issue