@dimailn/vuetify 2.7.2-alpha42 → 2.7.2-alpha43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vuetify.js +6 -5
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VInput/VInput.js +1 -1
- package/es5/components/VInput/VInput.js.map +1 -1
- package/es5/components/VTextField/VTextField.js +4 -3
- package/es5/components/VTextField/VTextField.js.map +1 -1
- package/es5/framework.js +1 -1
- package/lib/components/VInput/VInput.js +1 -1
- package/lib/components/VInput/VInput.js.map +1 -1
- package/lib/components/VTextField/VTextField.js +3 -2
- package/lib/components/VTextField/VTextField.js.map +1 -1
- package/lib/framework.js +1 -1
- package/package.json +1 -1
- package/src/components/VInput/VInput.ts +1 -1
- package/src/components/VTextField/VTextField.ts +3 -3
- package/src/components/VTextField/__tests__/VTextField.spec.ts +19 -12
|
@@ -86,7 +86,7 @@ export default baseMixins.extend({
|
|
|
86
86
|
}
|
|
87
87
|
},
|
|
88
88
|
|
|
89
|
-
emits: ['update:modelValue', 'blur', 'focus', 'keydown', 'click:clear', 'click'],
|
|
89
|
+
emits: ['update:modelValue', 'change', 'blur', 'focus', 'keydown', 'click:clear', 'click'],
|
|
90
90
|
|
|
91
91
|
data: () => ({
|
|
92
92
|
badInput: false,
|
|
@@ -387,7 +387,7 @@ export default baseMixins.extend({
|
|
|
387
387
|
genInput () {
|
|
388
388
|
const listeners = Object.assign({}, this.listeners$)
|
|
389
389
|
delete listeners.change // Change should not be bound externally
|
|
390
|
-
const { title, ...inputAttrs } = this.attrs$
|
|
390
|
+
const { title, onChange: _onChange, ...inputAttrs } = this.attrs$ as Record<string, any>
|
|
391
391
|
|
|
392
392
|
const node = h('input', {
|
|
393
393
|
style: {},
|
|
@@ -537,7 +537,7 @@ export default baseMixins.extend({
|
|
|
537
537
|
if (val) {
|
|
538
538
|
this.initialValue = this.lazyValue
|
|
539
539
|
} else if (this.initialValue !== this.lazyValue) {
|
|
540
|
-
this.$emit('
|
|
540
|
+
this.$emit('change', this.lazyValue)
|
|
541
541
|
}
|
|
542
542
|
},
|
|
543
543
|
onResize () {
|
|
@@ -2,6 +2,7 @@ import { h } from 'vue'
|
|
|
2
2
|
import VTextField from '../VTextField'
|
|
3
3
|
import VProgressLinear from '../../VProgressLinear'
|
|
4
4
|
import {
|
|
5
|
+
enableAutoUnmount,
|
|
5
6
|
mount,
|
|
6
7
|
MountingOptions,
|
|
7
8
|
VueWrapper
|
|
@@ -9,6 +10,8 @@ import {
|
|
|
9
10
|
import { waitAnimationFrame } from '../../../../test'
|
|
10
11
|
|
|
11
12
|
describe('VTextField.ts', () => { // eslint-disable-line max-statements
|
|
13
|
+
enableAutoUnmount(afterEach)
|
|
14
|
+
|
|
12
15
|
type Instance = InstanceType<typeof VTextField>
|
|
13
16
|
let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
|
|
14
17
|
let mocks: any
|
|
@@ -309,6 +312,10 @@ describe('VTextField.ts', () => { // eslint-disable-line max-statements
|
|
|
309
312
|
}
|
|
310
313
|
})
|
|
311
314
|
|
|
315
|
+
// Vue 3: слушатель @change родителя попадает в $attrs и может оказаться и на
|
|
316
|
+
// корне v-input, и на внутреннем input — тогда нативный change после blur
|
|
317
|
+
// вызывает обработчик дважды (target + bubble). Плюс нужен emit('change') при
|
|
318
|
+
// blur как во Vuetify 2.
|
|
312
319
|
it('should fire a single change event on blur', async () => {
|
|
313
320
|
let value = 'asd'
|
|
314
321
|
const change = jest.fn()
|
|
@@ -316,11 +323,9 @@ describe('VTextField.ts', () => { // eslint-disable-line max-statements
|
|
|
316
323
|
const component = {
|
|
317
324
|
render () {
|
|
318
325
|
return h(VTextField, {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
},
|
|
323
|
-
props: { value }
|
|
326
|
+
modelValue: value,
|
|
327
|
+
'onUpdate:modelValue': (v: string) => { value = v },
|
|
328
|
+
onChange: change
|
|
324
329
|
})
|
|
325
330
|
}
|
|
326
331
|
}
|
|
@@ -331,17 +336,19 @@ describe('VTextField.ts', () => { // eslint-disable-line max-statements
|
|
|
331
336
|
|
|
332
337
|
const input = wrapper.findAll('input')[0]
|
|
333
338
|
if (input) {
|
|
334
|
-
input.
|
|
339
|
+
const inputEl = input.element as HTMLInputElement
|
|
340
|
+
await input.trigger('focus')
|
|
335
341
|
await wrapper.vm.$nextTick()
|
|
336
|
-
|
|
337
|
-
input.trigger('input')
|
|
338
|
-
|
|
342
|
+
inputEl.value = 'fgh'
|
|
343
|
+
await input.trigger('input')
|
|
339
344
|
await wrapper.vm.$nextTick()
|
|
340
|
-
input.trigger('blur')
|
|
345
|
+
await input.trigger('blur')
|
|
346
|
+
await wrapper.vm.$nextTick()
|
|
347
|
+
inputEl.dispatchEvent(new Event('change', { bubbles: true }))
|
|
341
348
|
await wrapper.vm.$nextTick()
|
|
342
349
|
|
|
343
|
-
|
|
344
|
-
expect(
|
|
350
|
+
expect(change).toHaveBeenCalledWith('fgh')
|
|
351
|
+
expect(change.mock.calls).toHaveLength(1)
|
|
345
352
|
}
|
|
346
353
|
})
|
|
347
354
|
|