Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions projects/igniteui-angular/src/lib/slider/slider.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,22 @@ describe('IgxSlider', () => {
expect(slider.value.upper).toBe(60);
});

it('should reach max value with upper thumb in RANGE mode with decimal steps', () => {
slider.minValue = 0;
slider.maxValue = 10;
slider.step = 0.1;
slider.type = IgxSliderType.RANGE;
slider.value = { lower: 0, upper: 10 };
fixture.detectChanges();

const toThumb = fixture.nativeElement.querySelector(THUMB_TO_CLASS);
toThumb.focus();

UIInteractions.triggerKeyDownEvtUponElem('ArrowRight', toThumb, true);
fixture.detectChanges();

expect((slider.value as IRangeSliderValue).upper).toBe(10);
});
});

describe('Slider - List View', () => {
Expand Down
6 changes: 3 additions & 3 deletions projects/igniteui-angular/src/lib/slider/slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1354,11 +1354,11 @@ export class IgxSliderComponent implements
private normalizeByStep(value: IRangeSliderValue | number) {
if (this.isRange) {
this._value = {
lower: (value as IRangeSliderValue).lower - ((value as IRangeSliderValue).lower % this.step),
upper: (value as IRangeSliderValue).upper - ((value as IRangeSliderValue).upper % this.step)
lower: Math.floor((value as IRangeSliderValue).lower / this.step) * this.step,
upper: Math.floor((value as IRangeSliderValue).upper / this.step) * this.step
};
} else {
this._value = (value as number) - ((value as number) % this.step);
this._value = Math.floor((value as number) / this.step) * this.step;
}
}

Expand Down
Loading