Skip to content

Commit

Permalink
Fix focus change for updated slider
Browse files Browse the repository at this point in the history
  • Loading branch information
jwshinjwshin committed Aug 29, 2017
1 parent 377a3bb commit 81af644
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/slider/slider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ describe('MdSlider without forms', () => {
expect(sliderNativeElement.classList).not.toContain('mat-slider-sliding');
});

it('should remove focus after the slider is updated', () => {
spyOn(sliderNativeElement, 'blur');

expect(sliderNativeElement.blur).not.toHaveBeenCalled();

dispatchClickEventSequence(sliderNativeElement, 0.39);
fixture.detectChanges();

expect(sliderNativeElement.blur).toHaveBeenCalled();
});

it('should have thumb gap when at min value', () => {
expect(trackFillElement.style.transform).toContain('translateX(-7px)');
});
Expand Down
1 change: 1 addition & 0 deletions src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ export class MdSlider extends _MdSliderMixinBase
this._emitInputEvent();
this._emitChangeEvent();
}
this._elementRef.nativeElement.blur();
}

_onSlide(event: HammerInput) {
Expand Down

0 comments on commit 81af644

Please sign in to comment.