File tree 1 file changed +43
-0
lines changed
test/unit/features/component
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -886,4 +886,47 @@ describe('Component slot', () => {
886
886
expect ( vm . $el . textContent ) . toBe ( 'foo' )
887
887
} ) . then ( done )
888
888
} )
889
+
890
+ // #8337
891
+ it ( 'should not destroy the new child vm' , done => {
892
+ const Parent = {
893
+ render ( h ) {
894
+ return h ( this . API . tag , this . $slots . default )
895
+ } ,
896
+ data ( ) {
897
+ return { API : { tag : 'p' } }
898
+ } ,
899
+ provide ( ) {
900
+ return { key : this . API }
901
+ }
902
+ }
903
+
904
+ const Child = {
905
+ template : '<div></div>' ,
906
+ inject : { wrapper : 'key' } ,
907
+ created ( ) {
908
+ this . wrapper . tag = 'div'
909
+ }
910
+ }
911
+
912
+ const vm = new Vue ( {
913
+ components : {
914
+ Child,
915
+ Parent
916
+ } ,
917
+ template : `
918
+ <parent>
919
+ <div>
920
+ <child ref="child" />
921
+ </div>
922
+ </parent>
923
+ `
924
+ } ) . $mount ( )
925
+
926
+ expect ( vm . $refs . child ) . toBeDefined ( )
927
+
928
+ waitForUpdate ( ( ) => {
929
+ expect ( vm . $refs . child ) . toBeDefined ( )
930
+ } ) . then ( done )
931
+ } )
889
932
} )
You can’t perform that action at this time.
0 commit comments