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'
55
66function update ( ) {
77 this . _update ( this . _render ( ) )
8+ this . $children . forEach ( child => update . call ( child ) )
89}
910
1011export default class VueWrapper extends Wrapper implements BaseWrapper {
Original file line number Diff line number Diff line change @@ -11,6 +11,33 @@ describe('update', () => {
1111 expect ( wrapper . findAll ( '.child.ready' ) . length ) . to . equal ( 1 )
1212 } )
1313
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+
1441 it ( 'causes vm to re render, and retain slots' , ( ) => {
1542 const compiled = compileToFunctions ( '<div><slot></slot></div>' )
1643 const wrapper = mount ( compiled , { slots : { default : [ compileToFunctions ( '<div class="test-div" />' ) ] } } )
You can’t perform that action at this time.
0 commit comments