From ec06fc1efd05aaec6276151edf7894efd8a9fc65 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Mon, 27 Jun 2011 16:40:31 +0200 Subject: [PATCH] unit tests for #1851 added. --- tests/unit/checkboxradio/checkboxradio_core.js | 18 ++++++++++++++++++ tests/unit/checkboxradio/index.html | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/tests/unit/checkboxradio/checkboxradio_core.js b/tests/unit/checkboxradio/checkboxradio_core.js index 125d291e..a28ba36e 100644 --- a/tests/unit/checkboxradio/checkboxradio_core.js +++ b/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"); diff --git a/tests/unit/checkboxradio/index.html b/tests/unit/checkboxradio/index.html index c7d7ac94..cfed74f9 100644 --- a/tests/unit/checkboxradio/index.html +++ b/tests/unit/checkboxradio/index.html @@ -41,6 +41,19 @@ + +
+
+ Agree to the terms 3.1: + + +
+
+ Agree to the terms 3.2: + + +
+