Skip to content

Commit 42f4a64

Browse files
38elementseddyerburgh
authored andcommittedApr 10, 2018
fix(types): update packages/test-utils/types/index.d.ts (#522)
1 parent 74a27ae commit 42f4a64

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed
 

‎packages/test-utils/types/index.d.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ type RefSelector = {
3838
ref: string
3939
}
4040

41+
/**
42+
* Utility type for name options object that can be used as a Selector
43+
*/
44+
type NameSelector = {
45+
name: string
46+
}
47+
4148
/**
4249
* Base class of Wrapper and WrapperArray
4350
* It has common methods on both Wrapper and WrapperArray
@@ -61,7 +68,6 @@ interface BaseWrapper {
6168
isEmpty (): boolean
6269
isVueInstance (): boolean
6370

64-
update (): void
6571
setComputed (computed: object): void
6672
setData (data: object): void
6773
setMethods (data: object): void
@@ -80,12 +86,14 @@ export interface Wrapper<V extends Vue> extends BaseWrapper {
8086
find (selector: FunctionalComponentOptions): Wrapper<Vue>
8187
find (selector: string): Wrapper<Vue>
8288
find (selector: RefSelector): Wrapper<Vue>
89+
find (selector: NameSelector): Wrapper<Vue>
8390

8491
findAll<R extends Vue> (selector: VueClass<R>): WrapperArray<R>
8592
findAll<R extends Vue> (selector: ComponentOptions<R>): WrapperArray<R>
8693
findAll (selector: FunctionalComponentOptions): WrapperArray<Vue>
8794
findAll (selector: string): WrapperArray<Vue>
8895
findAll (selector: RefSelector): WrapperArray<Vue>
96+
findAll (selector: NameSelector): WrapperArray<Vue>
8997

9098
html (): string
9199
text (): string
@@ -116,6 +124,7 @@ interface MountOptions<V extends Vue> extends ComponentOptions<V> {
116124
stubs?: Stubs,
117125
attrs?: object
118126
listeners?: object
127+
sync?: boolean
119128
}
120129

121130
type ThisTypedMountOptions<V extends Vue> = MountOptions<V> & ThisType<V>

‎packages/test-utils/types/test/mount.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ mount(ClassComponent, {
4444
},
4545
listeners: {
4646
listener: () => {}
47-
}
47+
},
48+
sync: true
4849
})
4950

5051
mount(functionalOptions, {

‎packages/test-utils/types/test/wrapper.ts

+4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ let found = wrapper.find('.foo')
5353
found = wrapper.find(normalOptions)
5454
found = wrapper.find(functionalOptions)
5555
found = wrapper.find(ClassComponent)
56+
found = wrapper.find({ ref: 'myButton' })
57+
found = wrapper.find({ name: 'my-button' })
5658

5759
let array = wrapper.findAll('.bar')
5860
array = wrapper.findAll(normalOptions)
5961
array = wrapper.findAll(functionalOptions)
6062
array = wrapper.findAll(ClassComponent)
63+
array = wrapper.findAll({ ref: 'myButton' })
64+
array = wrapper.findAll({ name: 'my-button' })
6165

6266
let str: string = wrapper.html()
6367
str = wrapper.text()

0 commit comments

Comments
 (0)
Please sign in to comment.