Skip to content

Commit bae2731

Browse files
committed
types: add types for emitted() and emittedByOrder()
1 parent d4e14c2 commit bae2731

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

types/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ interface Wrapper<V extends Vue> extends BaseWrapper {
6767
html (): string
6868
text (): string
6969
name (): string
70+
71+
emitted (): { [name: string]: Array<Array<any>> }
72+
emittedByOrder (): Array<{ name: string, args: Array<any> }>
7073
}
7174

7275
interface WrapperArray<V extends Vue> extends BaseWrapper {

types/test/wrapper.ts

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ bool = wrapper.is(normalOptions)
2121
bool = wrapper.isEmpty()
2222
bool = wrapper.isVueInstance()
2323

24+
wrapper.vm.$emit('hello')
25+
26+
const emitted = wrapper.emitted()
27+
const arr: Array<any> = emitted.hello
28+
29+
const emittedByOrder = wrapper.emittedByOrder()
30+
const name: string = emittedByOrder[0].name
31+
2432
wrapper.update()
2533
wrapper.setData({ foo: 'bar' })
2634
wrapper.setMethods({checked: true})

0 commit comments

Comments
 (0)