Skip to content

Commit 012b0f0

Browse files
trodiValentinH
authored andcommitted
fix(options): Fix showing limit labels when pointer labels are always hidden (#373)
Previously limit labels would be hidden based on the position of the pointer labels even if user options hide pointer labels
1 parent f947823 commit 012b0f0

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

dist/rzslider.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.4.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-07-13 */
4+
2016-07-14 */
55
.rzslider {
66
position: relative;
77
display: inline-block;

dist/rzslider.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v5.4.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-07-13 */
4+
2016-07-14 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -1096,6 +1096,10 @@
10961096
* @returns {undefined}
10971097
*/
10981098
shFloorCeil: function() {
1099+
// Show based only on hideLimitLabels if pointer labels are hidden
1100+
if (this.options.hidePointerLabels) {
1101+
return;
1102+
}
10991103
var flHidden = false,
11001104
clHidden = false,
11011105
isRTL = this.options.rightToLeft,

dist/rzslider.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rzslider.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@
11001100
* @returns {undefined}
11011101
*/
11021102
shFloorCeil: function() {
1103+
// Show based only on hideLimitLabels if pointer labels are hidden
1104+
if (this.options.hidePointerLabels) {
1105+
return;
1106+
}
11031107
var flHidden = false,
11041108
clHidden = false,
11051109
isRTL = this.options.rightToLeft,

tests/specs/options-handling-test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,35 @@
402402
expect(helper.slider.cmbLab.rzAlwaysHide).to.be.true;
403403
});
404404

405+
it('should show floor and ceil labels when hidePointerLabels is true', function() {
406+
var sliderConf = {
407+
value: 100,
408+
options: {
409+
floor: 0,
410+
ceil: 100,
411+
hidePointerLabels: true
412+
}
413+
};
414+
helper.createSlider(sliderConf);
415+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
416+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
417+
});
418+
419+
it('should show floor and ceil labels when hidePointerLabels is true, for range slider', function() {
420+
var sliderConf = {
421+
minValue: 0,
422+
maxValue: 100,
423+
options: {
424+
floor: 0,
425+
ceil: 100,
426+
hidePointerLabels: true
427+
}
428+
};
429+
helper.createRangeSlider(sliderConf);
430+
expect(helper.slider.flrLab.css('visibility')).to.equal('visible');
431+
expect(helper.slider.ceilLab.css('visibility')).to.equal('visible');
432+
});
433+
405434
it('should set the correct background-color on selection bar for single slider', function() {
406435
var sliderConf = {
407436
value: 10,

0 commit comments

Comments
 (0)