Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 10870c8

Browse files
committed
fixup! fix(input): fix step validation for input[number]/input[range]
1 parent 7039395 commit 10870c8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/ng/directive/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ function countDecimals(num) {
15431543

15441544
if (decimalSymbolIndex === -1) {
15451545
if (-1 < num && num < 1) {
1546-
// It may be in the exponentional notation format (`1e-X`)
1546+
// It may be in the exponential notation format (`1e-X`)
15471547
var match = /e-(\d+)$/.exec(numString);
15481548

15491549
if (match) {

test/ng/directive/inputSpec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2731,7 +2731,8 @@ describe('input', function() {
27312731
expect(inputElm).toBeValid();
27322732
expect($rootScope.value).toBe(8);
27332733

2734-
$rootScope.$apply('min = 10; step = 20; value = 30');
2734+
$rootScope.$apply('min = 10; step = 20');
2735+
helper.changeInputValueTo('30');
27352736
expect(inputElm.val()).toBe('30');
27362737
expect(inputElm).toBeValid();
27372738
expect($rootScope.value).toBe(30);
@@ -2748,7 +2749,8 @@ describe('input', function() {
27482749
expect($rootScope.value).toBe(30);
27492750

27502751
// 0.3 - 0.2 === 0.09999999999999998
2751-
$rootScope.$apply('min = 0.2; step = 0.09999999999999998; value = 0.3');
2752+
$rootScope.$apply('min = 0.2; step = (0.3 - 0.2)');
2753+
helper.changeInputValueTo('0.3');
27522754
expect(inputElm.val()).toBe('0.3');
27532755
expect(inputElm).toBeInvalid();
27542756
expect(ngModel.$error.step).toBe(true);

0 commit comments

Comments
 (0)