Commit 8902c553 authored by Valentin Hervieu's avatar Valentin Hervieu

feat(hidePointerLabels): Add a hidePointerLabels option

Closes #273
parent 30d82dfd
......@@ -193,6 +193,7 @@ The default options are:
showSelectionBar: false,
showSelectionBarEnd: false,
showSelectionBarFromValue: null,
hidePointerLabels: false,
hideLimitLabels: false,
readOnly: false,
disabled: false,
......@@ -274,6 +275,8 @@ $scope.slider = {
**getPointerColor** - _Function(value, pointerType) (defaults to null)_: Function that returns the current color of a pointer. If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated. To handle range slider pointers independently, you should evaluate pointerType within the given function where "min" stands for `rzScopeModel` and "max" for `rzScopeHigh` values.
**hidePointerLabels** - _Boolean (defaults to false)_: Set to true to hide pointer labels
**hideLimitLabels** - _Boolean (defaults to false)_: Set to true to hide min / max labels
**readOnly** - _Boolean (defaults to false)_: Set to true to make the slider read-only.
......
......@@ -40,6 +40,7 @@
showSelectionBar: false,
showSelectionBarEnd: false,
showSelectionBarFromValue: null,
hidePointerLabels: false,
hideLimitLabels: false,
readOnly: false,
disabled: false,
......@@ -531,9 +532,9 @@
this.alwaysHide(this.flrLab, this.options.showTicksValues || this.options.hideLimitLabels);
this.alwaysHide(this.ceilLab, this.options.showTicksValues || this.options.hideLimitLabels);
this.alwaysHide(this.minLab, this.options.showTicksValues);
this.alwaysHide(this.maxLab, this.options.showTicksValues || !this.range);
this.alwaysHide(this.cmbLab, this.options.showTicksValues || !this.range);
this.alwaysHide(this.minLab, this.options.showTicksValues || this.options.hidePointerLabels);
this.alwaysHide(this.maxLab, this.options.showTicksValues || !this.range || this.options.hidePointerLabels);
this.alwaysHide(this.cmbLab, this.options.showTicksValues || !this.range || this.options.hidePointerLabels);
this.alwaysHide(this.selBar, !this.range && !this.options.showSelectionBar);
if (this.options.vertical)
......
This diff is collapsed.
......@@ -44,6 +44,7 @@
showSelectionBar: false,
showSelectionBarEnd: false,
showSelectionBarFromValue: null,
hidePointerLabels: false,
hideLimitLabels: false,
readOnly: false,
disabled: false,
......@@ -535,9 +536,9 @@
this.alwaysHide(this.flrLab, this.options.showTicksValues || this.options.hideLimitLabels);
this.alwaysHide(this.ceilLab, this.options.showTicksValues || this.options.hideLimitLabels);
this.alwaysHide(this.minLab, this.options.showTicksValues);
this.alwaysHide(this.maxLab, this.options.showTicksValues || !this.range);
this.alwaysHide(this.cmbLab, this.options.showTicksValues || !this.range);
this.alwaysHide(this.minLab, this.options.showTicksValues || this.options.hidePointerLabels);
this.alwaysHide(this.maxLab, this.options.showTicksValues || !this.range || this.options.hidePointerLabels);
this.alwaysHide(this.cmbLab, this.options.showTicksValues || !this.range || this.options.hidePointerLabels);
this.alwaysHide(this.selBar, !this.range && !this.options.showSelectionBar);
if (this.options.vertical)
......
......@@ -244,6 +244,43 @@
expect(helper.slider.selBar.css('left')).to.equal(expectedPosition + 'px');
});
it('should set alwaysHide on floor/ceil when hideLimitLabels is set to true', function() {
var sliderConf = {
value: 10,
options: {
hideLimitLabels: true
}
};
helper.createSlider(sliderConf);
expect(helper.slider.flrLab.rzAlwaysHide).to.be.true;
expect(helper.slider.ceilLab.rzAlwaysHide).to.be.true;
});
it('should set alwaysHide on minLab when hidePointerLabels is set to true on a single slider', function() {
var sliderConf = {
value: 10,
options: {
hidePointerLabels: true
}
};
helper.createSlider(sliderConf);
expect(helper.slider.minLab.rzAlwaysHide).to.be.true;
});
it('should set alwaysHide on minLab when hidePointerLabels is set to true on a single slider', function() {
var sliderConf = {
min: 10,
max: 100,
options: {
hidePointerLabels: true
}
};
helper.createRangeSlider(sliderConf);
expect(helper.slider.minLab.rzAlwaysHide).to.be.true;
expect(helper.slider.maxLab.rzAlwaysHide).to.be.true;
expect(helper.slider.cmbLab.rzAlwaysHide).to.be.true;
});
it('should set the correct background-color on selection bar for single slider', function() {
var sliderConf = {
value: 10,
......@@ -463,7 +500,7 @@
});
});
describe('range slider spcific - ', function() {
describe('range slider specific - ', function() {
beforeEach(function() {
var sliderConf = {
min: 10,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment