Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Collapsible: Adding funky characters to radio and form IDs in the test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Feb 10, 2014
1 parent 8cf6b38 commit 6f3afde
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
20 changes: 10 additions & 10 deletions tests/unit/checkboxradio/input-set-tests.html
Expand Up @@ -30,21 +30,21 @@
<div id="qunit"></div>

<div data-nstest-role="page">
<label>Radio<input id="radio1" type="radio" name="group1"></label>
<form id="the-form">
<label>Radio<input id="radio2" type="radio" name="group1"></label>
<label>Radio<input id="radio7" type="radio" name="group1" form="the-other-form"></label>
<label>Radio<input id="radio:1" type="radio" name="group1"></label>
<form id="the-[form]">
<label>Radio<input id="radio:2" type="radio" name="group1"></label>
<label>Radio<input id="radio:7" type="radio" name="group1" form="the-'other'-form"></label>
</form>
<label>Radio<input id="radio3" type="radio" name="group1" form="the-form"></label>
<form id="the-other-form">
<label>Radio<input id="radio6" type="radio" name="group1" form="the-form"></label>
<label>Radio<input id="radio4" type="radio" name="group1"></label>
<label>Radio<input id="radio:3" type="radio" name="group1" form="the-[form]"></label>
<form id="the-'other'-form">
<label>Radio<input id="radio:6" type="radio" name="group1" form="the-[form]"></label>
<label>Radio<input id="radio:4" type="radio" name="group1"></label>
</form>

<!-- radio5 (below) is not supposed to have a name -->
<label>Radio<input id="radio5" type="radio"></label>
<label>Radio<input id="radio:5" type="radio"></label>
</div>

<label>Radio<input id="radio8" type="radio" name="group1"></label>
<label>Radio<input id="radio:8" type="radio" name="group1"></label>
</body>
</html>
23 changes: 12 additions & 11 deletions tests/unit/checkboxradio/input_set_tests_core.js
Expand Up @@ -3,16 +3,17 @@
$.mobile.ns = "nstest-";

test( "Radio groups are correctly identified", function() {
var groups = {
"#radio1": "#radio1",
"#radio2": "#radio2,#radio3,#radio6",
"#radio3": "#radio2,#radio3,#radio6",
"#radio6": "#radio2,#radio3,#radio6",
"#radio4": "#radio4,#radio7",
"#radio7": "#radio4,#radio7",
"#radio5": "#radio5",
"#radio8": "#radio8"
};
var theDocument = $( document );
groups = {
"#radio\\:1": "#radio\\:1",
"#radio\\:2": "#radio\\:2,#radio\\:3,#radio\\:6",
"#radio\\:3": "#radio\\:2,#radio\\:3,#radio\\:6",
"#radio\\:6": "#radio\\:2,#radio\\:3,#radio\\:6",
"#radio\\:4": "#radio\\:4,#radio\\:7",
"#radio\\:7": "#radio\\:4,#radio\\:7",
"#radio\\:5": "#radio\\:5",
"#radio\\:8": "#radio\\:8"
};

$.each( groups, function( index, value ) {
var result,
Expand All @@ -22,7 +23,7 @@ test( "Radio groups are correctly identified", function() {
result = $.mobile.checkboxradio.prototype._getInputSet.call({
element: radio,
inputtype: "radio",
document: $( document )
document: theDocument
});
deepEqual( group.length, result.length,
index + ": length of group is correct" );
Expand Down

0 comments on commit 6f3afde

Please sign in to comment.