Skip to content

Commit fe9c632

Browse files
committed
fix: mask on 2nd input event from vuetify in firefox
fixes #17
1 parent 9c918c4 commit fe9c632

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/core.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,12 @@ export function updateValue(el, vnode, { emit = true, force = false } = {}, even
156156
el.unmaskedValue = newValue.unmasked
157157

158158
// safari makes the cursor jump to the end if el.value gets assign even if to the same value
159-
// additionally, vuetify is trigering directive.update twice at init, this check ensures we only emit once
160159
if (el.value !== newValue.masked) {
161160
el.value = newValue.masked
162-
emit && el.dispatchEvent(FacadeInputEvent())
163161
}
162+
163+
// this part needs to be outside the above IF statement for vuetify in firefox
164+
// draweback is that we endup with two's input events in firefox
165+
emit && el.dispatchEvent(FacadeInputEvent())
164166
}
165167
}

tests/component.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ describe('Component', () => {
6969
const input = wrapper.find('input')
7070

7171
input.trigger('change')
72-
expect(wrapper.emitted().input).toBeFalsy()
72+
// only the initial input should be present
73+
expect(wrapper.emitted().input.length).toEqual(1)
7374
})
7475

7576
test('Adding a format function should call that function on input', async () => {

0 commit comments

Comments
 (0)