Skip to content

Commit 2329727

Browse files
moxon6oriondean
authored andcommitted
Have values match initial values when all input deleted
1 parent 1700f25 commit 2329727

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/helpers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ exports.allowedZero = function(val, char, caretPos, options) {
184184
*/
185185
exports.formattedToRaw = function(formattedValue, options) {
186186
if (is.not.string(formattedValue)) return NaN;
187+
if (!formattedValue.length) return undefined;
187188

188189
// Number(...) accepts thousands ',' or '' and decimal '.' so we must:
189190

test/unit/setRawValue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ describe('setRawValue', () => {
2424
expect(element.rawValue).toBe(undefined);
2525
});
2626

27-
it('sets value to empty string and rawValue to 0 when entry is deleted', () => {
27+
it('resets back to empty string and undefined when entry is deleted', () => {
2828
element.setRawValue(100);
2929
element.setRawValue('');
3030

3131
expect(element.value).toBe('');
32-
expect(element.rawValue).toBe(0);
32+
expect(element.rawValue).toBe(undefined);
3333
});
3434

3535
});

0 commit comments

Comments
 (0)