Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4449 from jasondscott/3981_SliderIdTests

Added tests for #3981 - Slider label ID gets overwritten
  • Loading branch information...
commit f9f5e3429edad3f1b977f6b08f5ae49616f0a9ab 2 parents 2ef3038 + aa4886a
@jasondscott jasondscott authored
Showing with 17 additions and 1 deletion.
  1. +5 −0 tests/unit/slider/index.html
  2. +12 −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
13 tests/unit/slider/slider_core.js
@@ -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 );
Please sign in to comment.
Something went wrong with that request. Please try again.