File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
test/unit/specs/mount/Wrapper Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { logEvents } from '../lib/log-events'
5
5
6
6
function update ( ) {
7
7
this . _update ( this . _render ( ) )
8
+ this . $children . forEach ( child => update . call ( child ) )
8
9
}
9
10
10
11
export default class VueWrapper extends Wrapper implements BaseWrapper {
Original file line number Diff line number Diff line change @@ -11,6 +11,33 @@ describe('update', () => {
11
11
expect ( wrapper . findAll ( '.child.ready' ) . length ) . to . equal ( 1 )
12
12
} )
13
13
14
+ it ( 'updates slot components' , ( ) => {
15
+ const SlotComponent = compileToFunctions ( '<div><slot></slot></div>' )
16
+ const Parent = {
17
+ template : `
18
+ <SlotComponent>
19
+ <div :class="[{ 'is-on': on }, 'inner']"></div>
20
+ </SlotComponent>
21
+ ` ,
22
+ props : {
23
+ on : {
24
+ default : false ,
25
+ type : Boolean
26
+ }
27
+ } ,
28
+ components : {
29
+ SlotComponent
30
+ }
31
+ }
32
+ const parentWrapper = mount ( Parent )
33
+ const innerEl = parentWrapper . find ( '.inner' )
34
+ expect ( innerEl . hasClass ( 'is-on' ) ) . to . equal ( false )
35
+ parentWrapper . setProps ( {
36
+ on : true
37
+ } )
38
+ expect ( innerEl . hasClass ( 'is-on' ) ) . to . equal ( true )
39
+ } )
40
+
14
41
it ( 'causes vm to re render, and retain slots' , ( ) => {
15
42
const compiled = compileToFunctions ( '<div><slot></slot></div>' )
16
43
const wrapper = mount ( compiled , { slots : { default : [ compileToFunctions ( '<div class="test-div" />' ) ] } } )
You can’t perform that action at this time.
0 commit comments