diff --git a/components/core/util/number.ts b/components/core/util/number.ts index 946f97d832f..28ed8836902 100644 --- a/components/core/util/number.ts +++ b/components/core/util/number.ts @@ -12,6 +12,7 @@ export function ensureNumberInRange(num: number, min: number, max: number): numb if (isNaN(num) || num < min) { return min; } else if (num > max) { + console.log('captured max'); return max; } else { return num; diff --git a/components/slider/nz-slider-error.ts b/components/slider/nz-slider-error.ts index 542146ec961..e8e7f558dc7 100644 --- a/components/slider/nz-slider-error.ts +++ b/components/slider/nz-slider-error.ts @@ -1,7 +1,3 @@ export function getValueTypeNotMatchError(): Error { return new Error(`The "nzRange" can't match the "nzValue"'s type, please check these properties: "nzRange", "nzValue", "nzDefaultValue".`); } - -export function getValueTypeNotLegalError(): Error { - return new Error(``); -} \ No newline at end of file diff --git a/components/slider/nz-slider.component.ts b/components/slider/nz-slider.component.ts index 3e34b3b423b..99bbb5e29af 100644 --- a/components/slider/nz-slider.component.ts +++ b/components/slider/nz-slider.component.ts @@ -124,6 +124,11 @@ export class NzSliderComponent implements ControlValueAccessor, OnInit, OnChange this.onTouched = fn; } + setDisabledState(isDisabled: boolean): void { + this.nzDisabled = isDisabled; + this.toggleDragDisabled(isDisabled); + } + private setValue(value: SliderValue, isWriteValue: boolean = false): void { if (isWriteValue) { this.value = this.formatValue(value); @@ -204,6 +209,8 @@ export class NzSliderComponent implements ControlValueAccessor, OnInit, OnChange }); [ this.bounds.lower, this.bounds.upper ] = boundParts; [ this.track.offset, this.track.length ] = trackParts; + + this.cdr.markForCheck(); } private onDragStart(value: number): void { diff --git a/components/slider/nz-slider.spec.ts b/components/slider/nz-slider.spec.ts index 6070a0feb35..7dbee82bc58 100644 --- a/components/slider/nz-slider.spec.ts +++ b/components/slider/nz-slider.spec.ts @@ -123,10 +123,6 @@ describe('NzSlider', () => { expect(onChangeSpy).toHaveBeenCalledTimes(1); }); - it('should pass un-covered code testing', () => { - expect(sliderInstance.getValueToOffset()).toBe(sliderInstance.value); - }); - it('should always display tooltip work', () => { });