File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ export class VueWrapper<
213213 }
214214 }
215215
216- get element ( ) : Element {
216+ get element ( ) : T [ '$el' ] {
217217 // if the component has multiple root elements, we use the parent's element
218218 return this . hasMultipleRoots ? this . parentElement : this . vm . $el
219219 }
Original file line number Diff line number Diff line change @@ -14,6 +14,16 @@ const domWrapper = wrapper.find('#other')
1414let inputMaybe = wrapper . find ( 'input' )
1515expectType < HTMLInputElement | undefined > ( inputMaybe . element )
1616
17+ let buttonComp = mount (
18+ defineComponent ( { template : '<button>Click me</button>' } )
19+ )
20+ expectType < HTMLButtonElement > ( buttonComp . element )
21+
22+ let multiRootComp = mount ( defineComponent ( { template : '<span /><span />' } ) )
23+ // this will be a wrapper div element like so: <div data-v-app="">
24+ expectType < HTMLDivElement > ( multiRootComp . element )
25+ expectType < HTMLSpanElement > ( multiRootComp . element . firstElementChild )
26+
1727// SVG element selector
1828let lineMaybe = wrapper . find ( 'line' )
1929expectType < SVGLineElement | undefined > ( lineMaybe . element )
You can’t perform that action at this time.
0 commit comments