Permalink
Browse files

Added tests for #3981 - Slider label ID gets overwritten

Tests for Issue #3981 and PR #4433
  • Loading branch information...
1 parent 81cc987 commit 8c7d3e91d9e4c867524c637a8257095cd5a453e0 Jason Scott committed May 25, 2012
Showing with 16 additions and 1 deletion.
  1. +5 −0 tests/unit/slider/index.html
  2. +11 −1 tests/unit/slider/slider_core.js
View
5 tests/unit/slider/index.html
@@ -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">
View
12 tests/unit/slider/slider_core.js
@@ -44,4 +44,14 @@
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 slider = $("[for=label-id-slider]");
+ equal(slider.attr("id"), "label-id");
+ });
+
+ test( "labels without an id get an id", function() {
+ var slider = $("[for=empty-string-val-slider]");
+ ok(slider.attr("id"));
+ });
+})( jQuery );

0 comments on commit 8c7d3e9

Please sign in to comment.