component.writeValue(11.1)
expect(component.value).toEqual(11.1)
})
+
+ it('should support scientific notation', () => {
+ component.writeValue(1.23456789e8)
+ expect(component.value).toEqual(123456789)
+ })
})
}
writeValue(newValue: any): void {
- if (this.step === 1) newValue = parseInt(newValue, 10)
+ if (this.step === 1 && newValue?.toString().indexOf('e') === -1)
+ newValue = parseInt(newValue, 10)
if (this.step === 0.01) newValue = parseFloat(newValue).toFixed(2)
super.writeValue(newValue)
}