File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -216,10 +216,7 @@ export class VueWrapper<T extends ComponentPublicInstance> {
216
216
)
217
217
}
218
218
219
- if ( this . parentElement ) {
220
- this . parentElement . removeChild ( this . element )
221
- }
222
- this . __app . unmount ( this . element )
219
+ this . __app . unmount ( this . parentElement )
223
220
}
224
221
}
225
222
Original file line number Diff line number Diff line change
1
+ import { mount } from '../src'
2
+
3
+ const AXIOM = 'Rem is the best girl'
4
+
5
+ describe ( 'Unmount' , ( ) => {
6
+ it ( 'works on single root component' , ( ) => {
7
+ const Component = {
8
+ template : `
9
+ <div>${ AXIOM } </div>
10
+ ` ,
11
+ onErrorCaptured ( err : Error ) {
12
+ throw err
13
+ }
14
+ }
15
+ const wrapper = mount ( Component )
16
+ expect ( ( ) => wrapper . unmount ( ) ) . not . toThrowError ( )
17
+ } )
18
+
19
+ it ( 'works on multi-root component' , ( ) => {
20
+ const Component = {
21
+ template : `
22
+ <div>${ AXIOM } </div>
23
+ <div>${ AXIOM } </div>
24
+ ` ,
25
+ onErrorCaptured ( err : Error ) {
26
+ throw err
27
+ }
28
+ }
29
+ const wrapper = mount ( Component )
30
+ wrapper . unmount ( )
31
+ } )
32
+ } )
You can’t perform that action at this time.
0 commit comments