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

Commit

Permalink
[controlgroup functional test] Add "Nothing" option to "Remove" and "…
Browse files Browse the repository at this point in the history
…Hide" to prevent grouped items from disappearing so that checkbox behaviour may be studied
  • Loading branch information
Gabriel Schulhof committed Nov 9, 2012
1 parent 2c064f2 commit 89d9816
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/functional/controlgroup.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@
$( "#prepend,#append", e.target ).bind( "click", function( e ) {
counter++;
var widgetType = $( "[name='radio-widget']:checked" ).attr( "id" ),
grp = $( "#controlgroup" ),
op = $( "[name='radio-op']:checked" ).attr( "id" ),
$el;
grp = $( "#controlgroup" ), $el,
action = function() {
var op = $( "[name='radio-op']:checked" ).attr( "id" );
$el[ op ](); grp.controlgroup( "refresh" );
};

if ( widgetType === "link" ) {
$el = $( "<a href='#'>Remove " + counter + "</a>" ).bind( "click", function( e ) { $el[op](); grp.controlgroup( "refresh" ); } );
$el = $( "<a href='#'>Remove " + counter + "</a>" ).bind( "click", action );
$( "#controlgroup" ).controlgroup( "container" )[ $( this ).attr( "id" ) ]( $el );
$el.buttonMarkup();
} else if ( widgetType === "select" ) {
$el = $( "<label for='widget" + counter + "'>Select " + counter + "</label><select id='widget" + counter + "'><option id='widget" + counter + "' value='default'>Select " + counter + "</option><option value='remove'>Remove</option></select>" );
$( $el[ 1 ] ).bind( "change", function( e ) { $el[op](); grp.controlgroup( "refresh" ); });
$( $el[ 1 ] ).bind( "change", action);
$( "#controlgroup" ).controlgroup( "container" )[ $( this ).attr( "id" ) ]( $el );
$( $el[ 1 ] ).selectmenu();
} else {
$el = $( "<label for='widget" + counter + "'>Remove " + counter + "</label><input type='checkbox' id='widget" + counter + "'></input>" );
$( $el[ 1 ] ).bind( "change", function( e ) { $el[op](); grp.controlgroup( "refresh" ); });
$( $el[ 1 ] ).bind( "change", action );
$( "#controlgroup" ).controlgroup( "container" )[ $( this ).attr( "id" ) ]( $el );
$( $el[ 1 ] ).checkboxradio();
}
Expand Down Expand Up @@ -78,6 +80,9 @@ <h1>Controlroup Dynamic Modification</h1>

<input type="radio" name="radio-op" id="hide" value="hide" />
<label for="hide">Hide</label>

<input type="radio" name="radio-op" id="width" value="width" />
<label for="width">Nothing</label>
</fieldset>
<div data-role="fieldcontain">
<input id="isHorizontal" data-inline="true" type="checkbox"></input>
Expand Down

0 comments on commit 89d9816

Please sign in to comment.