Skip to content

Commit

Permalink
Slider: value on button not updated
Browse files Browse the repository at this point in the history
  • Loading branch information
cgack committed Apr 1, 2014
1 parent 8197bb0 commit dfe3869
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/widgets/forms/slider.tooltip.js
Expand Up @@ -93,6 +93,9 @@ $.widget( "mobile.slider", $.mobile.slider, {
if ( o.popupEnabled && this._popup ) {
this._positionPopup();
this._popup.html( newValue );
if (o.showValue) {
this.handle.html( newValue );
}
} else if ( o.showValue && !this.options.mini ) {
this.handle.html( newValue );
}
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/slider/index.html
Expand Up @@ -124,6 +124,10 @@
<input type="range" name="tooltip-test" id="tooltip-test" value="17" min="0" max="100" data-nstest-popup-enabled="true"/>
</label>

<label>Tooltip w/ Button value:
<input type="range" name="tooltip-test-both" id="tooltip-test-both" value="17" min="0" max="100" data-nstest-popup-enabled="true" data-nstest-show-value="true"/>
</label>

</div>

<div id="enhancetest">
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/slider/slider_core.js
Expand Up @@ -105,4 +105,11 @@
});
slider.trigger( "mouseup" );
});

test( "slider tooltip & button values should match after input value changes", function() {
var slider = $("#tooltip-test-both");
var sliderHandle = slider.siblings(".ui-slider-track").children(".ui-slider-handle");

ok( slider.val() === sliderHandle.text(), "slider text should match handle text");
});
})( jQuery );

0 comments on commit dfe3869

Please sign in to comment.