Added tests for #3981 - Slider label ID gets overwritten #4449

Merged
merged 2 commits into from May 25, 2012
Jump to file or symbol
Failed to load files and symbols.
+17 −1
Split
@@ -91,6 +91,11 @@ <h2 id="qunit-userAgent"></h2>
<label for="empty-string-val-slider">Input slider:</label>
<input type="range" name="empty-string-val-slider" id="empty-string-val-slider" value="25" min="10" max="100" step="20"/>
</div>
+
+ <div data-role="fieldcontain">
+ <label id="label-id" for="label-id-slider">Input slider:</label>
+ <input type="range" name="slider" id="label-id-slider" value="25" min="0" max="100"/>
+ </div>
</div>
<div id="enhancetest">
@@ -44,4 +44,15 @@
same( $unhighlighted.siblings( ".ui-slider" ).find( ".ui-slider-bg" ).length, 0,
"unhighlighted slider _not_ should have a div for the track bg" );
});
-})( jQuery );
+
+ test( "labels that have id keep that id", function() {
+ var label = $( "[for=label-id-slider]" );
+ equal(label.attr( "id" ), "label-id", "label id was not changed" );
+ });
+
+ test( "labels without an id get an id", function() {
+ var slider = $( "#empty-string-val-slider" ),
+ label = $( "[for=empty-string-val-slider]" );
+ equal(label.attr( "id" ), slider.attr( "id" ) + "-label", "the label id is based off the slider id" );
+ });
+})( jQuery );