11
22import { expect } from 'chai' ;
33import 'mocha' ;
4- import { Component , Provide , Base , Inject } from '../../dist'
5- import { VueWrapper , mount } from '@vue/test-utils' ;
4+ import { Component , Provide , Base , Inject , toNative } from '../../dist'
5+ import { VueWrapper , mount } from '@vue/test-utils' ;
66
77describe ( 'decorator Provide' ,
88 ( ) => {
@@ -23,7 +23,7 @@ describe('decorator Provide',
2323 readonly _internalName = 123
2424 }
2525
26- @Component ( { template : '<span />' } )
26+ @Component ( { template : '<span />' } )
2727 class Child extends Base {
2828 @Inject
2929 readonly fromClassDecorator ! : string
@@ -84,7 +84,7 @@ describe('decorator Provide',
8484 readonly ambiguous = 'property'
8585 }
8686
87- @Component ( { template : '<span />' } )
87+ @Component ( { template : '<span />' } )
8888 class Child extends Base {
8989 @Inject
9090 readonly ambiguous ! : string
@@ -105,5 +105,34 @@ describe('decorator Provide',
105105
106106 expect ( child . vm . ambiguous ) . to . equal ( 'class' )
107107 } )
108+
109+ it ( 'preserve feild' , ( ) => {
110+ @Component ( {
111+ template : '<div><slot/></div>' ,
112+ } )
113+ class Comp extends Base {
114+ @Provide
115+ readonly vp = 'foo'
116+ v ! : string
117+
118+ @Provide
119+ fp ( ) { }
120+ f ! : Function
121+ mounted ( ) {
122+
123+ this . v = this . vp
124+ this . f = this . fp
125+
126+ }
127+
128+
129+ }
130+
131+
132+ const component = mount ( toNative ( Comp ) as any )
133+
134+ expect ( component . vm . v ) . to . equal ( 'foo' )
135+ expect ( typeof component . vm . f ) . to . equal ( 'function' )
136+ } )
108137 }
109138)
0 commit comments