-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
/
Copy pathcustomElementCasing.spec.ts
42 lines (38 loc) · 1.04 KB
/
customElementCasing.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { createApp } from '../src'
// https://github.com/vuejs/docs/pull/1890
// https://github.com/vuejs/core/issues/5401
// https://github.com/vuejs/docs/issues/1708
test('custom element event casing', () => {
customElements.define(
'custom-event-casing',
class Foo extends HTMLElement {
connectedCallback() {
this.dispatchEvent(new Event('camelCase'))
this.dispatchEvent(new Event('CAPScase'))
this.dispatchEvent(new Event('PascalCase'))
}
},
)
const container = document.createElement('div')
document.body.appendChild(container)
const handler = vi.fn()
const handler2 = vi.fn()
createApp({
template: `
<custom-event-casing
@camelCase="handler"
@CAPScase="handler"
@PascalCase="handler"
v-on="{
camelCase: handler2,
CAPScase: handler2,
PascalCase: handler2
}" />`,
methods: {
handler,
handler2,
},
}).mount(container)
expect(handler).toHaveBeenCalledTimes(3)
expect(handler2).toHaveBeenCalledTimes(3)
})