unit tests for #1851 added.

This commit is contained in:
Tobias Bosch 2011-06-27 16:40:31 +02:00
parent ff2ef4076b
commit ec06fc1efd
2 changed files with 31 additions and 0 deletions

View file

@ -27,6 +27,24 @@
ok(!button.hasClass("ui-btn-active"), "no active styles after click");
});
test( "clicking a checkbox within a controlgroup does not affect checkboxes with the same name in the same controlgroup", function(){
var input1 = $("#checkbox-31");
var button1 = input1.parent().find(".ui-btn");
var input2 = $("#checkbox-32");
var button2 = input2.parent().find(".ui-btn");
ok(!input1.attr("checked"), "input1 not checked before click");
ok(!input2.attr("checked"), "input2 not checked before click");
button1.trigger("click");
ok(input1.attr("checked"), "input1 checked after click on input1");
ok(!input2.attr("checked"), "input2 not checked after click on input1");
button2.trigger("click");
ok(input1.attr("checked"), "input1 not changed after click on input2");
ok(input2.attr("checked"), "input2 checked after click on input2");
});
asyncTest( "change events fired on checkbox for both check and uncheck", function(){
var $checkbox = $("#checkbox-2"),
$checkboxLabel = $checkbox.parent().find(".ui-btn");

View file

@ -41,6 +41,19 @@
<label for="checkbox-2">I agree</label>
</fieldset>
</div>
<div data-nstest-role="fieldcontain" data-nstest-role="controlgroup">
<div>
<legend>Agree to the terms 3.1:</legend>
<input type="checkbox" name="checkbox-3" id="checkbox-31" class="custom"/>
<label for="checkbox-31">I agree 3.1</label>
</div>
<div>
<legend>Agree to the terms 3.2:</legend>
<input type="checkbox" name="checkbox-3" id="checkbox-32" class="custom"/>
<label for="checkbox-32">I agree 3.2</label>
</div>
</div>
</div>
<div data-role="fieldcontain" id="radio-active-btn-test">