Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unit tests for #1851 added.

  • Loading branch information...
commit cee915051d83c1f0c693bc2783420519fab41c63 1 parent cfb904e
Tobias Bosch authored
View
18 tests/unit/checkboxradio/checkboxradio_core.js
@@ -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
13 tests/unit/checkboxradio/index.html
@@ -41,6 +41,19 @@ <h2 id="qunit-userAgent"></h2>
<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">
Please sign in to comment.
Something went wrong with that request. Please try again.