Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime-vapor): component emits #103

Merged
merged 26 commits into from
Feb 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3ec807b
feat(runtime-vapor): component emits
ubugeeei Jan 30, 2024
8f15d06
Merge branch 'main' of github.com:vuejs/core-vapor into ubugeeei/feat…
ubugeeei Jan 31, 2024
41dafac
test(runtime-vapor): component emits (base)
ubugeeei Feb 1, 2024
d19625d
feat(runtime-vapor): init component emits
ubugeeei Feb 1, 2024
0af8ffe
feat(runtime-vapor): provide component emits into setup fn
ubugeeei Feb 1, 2024
c74236a
test(runtime-vapor): component emits (trigger handlers)
ubugeeei Feb 1, 2024
e5a7712
chore: comment out unimplemented code
ubugeeei Feb 1, 2024
5eeffcc
test(runtime-vapor): component emits (trigger camelCase handler)
ubugeeei Feb 1, 2024
c707e27
test(runtime-vapor): component emits (trigger kebab-case handler)
ubugeeei Feb 1, 2024
8ed282f
test(runtime-vapor): component emits (trigger mixed case handlers)
ubugeeei Feb 1, 2024
d0e1ed7
feat(runtime-vapor): trigger hyphenated events for update:xxx events
ubugeeei Feb 1, 2024
bd3ffe5
feat(runtime-vapor): call emit handler with async error handling
ubugeeei Feb 1, 2024
d240d3d
test(runtime-vapor): component emits (should trigger array of listeners)
ubugeeei Feb 1, 2024
3852eeb
test(runtime-vapor): component emits (should not warn if has equivale…
ubugeeei Feb 1, 2024
aaa2add
test(runtime-vapor): component emits (.once)
ubugeeei Feb 1, 2024
9adfff5
test(runtime-vapor): component emits (.once with normal listener of t…
ubugeeei Feb 1, 2024
51b801d
test(runtime-vapor): component emits (.number modifier should work wi…
ubugeeei Feb 1, 2024
f73e7e7
chore: remove dead code
ubugeeei Feb 1, 2024
31180b6
test(runtime-vapor): component emits (.trim modifier should work with…
ubugeeei Feb 1, 2024
510f2b1
test(runtime-vapor): component emits (.trim and .number modifiers sho…
ubugeeei Feb 1, 2024
acc0d98
test(runtime-vapor): component emits (only trim string parameter when…
ubugeeei Feb 1, 2024
0d17ba7
feat(runtime-vapor): isEmitListener
ubugeeei Feb 1, 2024
feb813d
test(runtime-vapor): component emits (does not emit after unmount)
ubugeeei Feb 1, 2024
bc86277
chore: add comments
ubugeeei Feb 1, 2024
8c0e07b
Merge branch 'main' of github.com:vuejs/core-vapor into ubugeeei/feat…
ubugeeei Feb 3, 2024
6efe75b
refactor
sxzz Feb 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(runtime-vapor): component emits (trigger mixed case handlers)
  • Loading branch information
ubugeeei committed Feb 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8ed282f270aaac8f5c2a0056f79dfa2ae58d3ad5
28 changes: 27 additions & 1 deletion packages/runtime-vapor/__tests__/componentEmits.spec.ts
Original file line number Diff line number Diff line change
@@ -92,7 +92,33 @@ describe('component: emit', () => {
})

// #3527
test.todo('trigger mixed case handlers', () => {})
test.todo('trigger mixed case handlers', () => {
const Foo = defineComponent({
render() {},
setup(_: any, { emit }: any) {
emit('test-event')
emit('testEvent')
},
})

const fooSpy = vi.fn()
const barSpy = vi.fn()
render(
Foo,
// TODO: impl `toHandlers`
{
get ['onTest-Event']() {
return fooSpy
},
get onTestEvent() {
return barSpy
},
},
'#host',
)
expect(fooSpy).toHaveBeenCalledTimes(1)
expect(barSpy).toHaveBeenCalledTimes(1)
})

// for v-model:foo-bar usage in DOM templates
test.todo('trigger hyphenated events for update:xxx events', () => {})