mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-20 14:20:59 +00:00
test added for checkbox check and uncheck firing change
This commit is contained in:
parent
4dc2560895
commit
ceed56fb2a
2 changed files with 40 additions and 10 deletions
|
|
@ -26,4 +26,26 @@
|
|||
ok(!input.attr("checked"), "not checked after click");
|
||||
ok(!button.hasClass("ui-btn-active"), "no active styles after click");
|
||||
});
|
||||
|
||||
asyncTest( "change events fired on checkbox for both check and uncheck", function(){
|
||||
var $checkbox = $("#checkbox-2"),
|
||||
$checkboxLabel = $("[for=checkbox-2]");
|
||||
|
||||
$checkbox.unbind("change");
|
||||
|
||||
expect( 2 );
|
||||
|
||||
$checkbox.change(function(){
|
||||
ok(true, "change fired on click to check the box");
|
||||
});
|
||||
|
||||
$checkboxLabel.trigger("click");
|
||||
|
||||
//test above will be triggered twice as will the start here
|
||||
$checkbox.change(function(){
|
||||
start();
|
||||
});
|
||||
|
||||
$checkboxLabel.trigger("click");
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
|||
|
|
@ -23,17 +23,25 @@
|
|||
<ol id="qunit-tests">
|
||||
</ol>
|
||||
|
||||
<div id="qunit-fixture">
|
||||
<div data-nstest-role="page">
|
||||
<div data-nstest-role="content">
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom" />
|
||||
<label for="checkbox-1">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div data-nstest-role="page">
|
||||
<div data-nstest-role="content">
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-1" id="checkbox-1" class="custom"/>
|
||||
<label for="checkbox-1">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div data-nstest-role="fieldcontain">
|
||||
<fieldset data-nstest-role="controlgroup">
|
||||
<legend>Agree to the terms:</legend>
|
||||
<input type="checkbox" name="checkbox-2" id="checkbox-2" class="custom"/>
|
||||
<label for="checkbox-2">I agree</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue