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

Commit

Permalink
Unit tests: Checkboxradio: Make sure that checkboxradio widgets based…
Browse files Browse the repository at this point in the history
… on checkboxes with IDs containing weird characters are enhanced correctly. Re: #6052.
  • Loading branch information
Gabriel Schulhof committed Aug 13, 2013
1 parent 0b4e538 commit d910ccb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/unit/checkboxradio/checkboxradio_core.js
Expand Up @@ -4,6 +4,12 @@
(function($){
module( 'jquery.mobile.forms.checkboxradio.js' );

test( "widget with weird label is created successfully", function() {
var elem = $( "#chk\\[\\'3\\'\\]-1" );
ok( elem.parent().is( "div.ui-checkbox" ), "element has been wrapped in a div.ui-checkbox" );
ok( elem.siblings( "label[for='chk\\[\\'3\\'\\]-1']" ).length === 1, "element has exactly one sibling of the form label[for='chk[\'3\']-1']" );
});

test( "widget can be disabled and enabled", function(){
var input = $( "#checkbox-1" ),
button = input.parent().find( ".ui-btn" );
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/checkboxradio/index.html
Expand Up @@ -40,6 +40,9 @@ <h2 id="qunit-userAgent"></h2>
<div data-nstest-role="page" data-nstest-theme="b">
<div data-nstest-role="content">

<input type="checkbox" id="chk['3']-1"></input>
<label for="chk['3']-1">Checkbox label</label>

<div data-nstest-role="fieldcontain">
<fieldset data-nstest-role="controlgroup">
<legend>Agree to the terms:</legend>
Expand Down

0 comments on commit d910ccb

Please sign in to comment.