Skip to content

Commit cf55756

Browse files
vwxyutaroooeddyerburgh
authored andcommitted
fix: typing error with props and attributes (#433)
* test: add attributes() and props() to type test * fix: type props and attributes in BaseWrapper #432
1 parent 510bb2f commit cf55756

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

types/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ interface BaseWrapper {
4747
exists (): boolean
4848
visible (): boolean
4949

50-
attributes(): { [name: string]: string } | void
50+
attributes(): { [name: string]: string }
5151
classes(): Array<string> | void
52-
props(): { [name: string]: any } | void
52+
props(): { [name: string]: any }
5353

5454
hasAttribute (attribute: string, value: string): boolean
5555
hasClass (className: string): boolean

types/test/wrapper.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ bool = wrapper.contains(ClassComponent)
1313
bool = wrapper.exists()
1414

1515
bool = wrapper.hasAttribute('foo', 'bar')
16+
bool = wrapper.attributes().foo === 'bar'
1617
bool = wrapper.hasClass('foo-class')
1718
bool = wrapper.hasProp('checked', true)
19+
bool = wrapper.props().checked
1820
bool = wrapper.hasStyle('color', 'red')
1921

2022
bool = wrapper.is(normalOptions)

0 commit comments

Comments
 (0)