@@ -251,30 +251,56 @@ test('INSTANCE_LISTENERS', () => {
251251 ) . toHaveBeenWarned ( )
252252} )
253253
254- test ( 'INSTANCE_SCOPED_SLOTS' , ( ) => {
255- let slots : Slots
256- new Vue ( {
257- template : `<child v-slot="{ msg }">{{ msg }}</child>` ,
258- components : {
259- child : {
260- compatConfig : { RENDER_FUNCTION : false } ,
261- render ( ) {
262- slots = this . $scopedSlots
254+ describe ( 'INSTANCE_SCOPED_SLOTS' , ( ) => {
255+ test ( 'explicit usage' , ( ) => {
256+ let slots : Slots
257+ new Vue ( {
258+ template : `<child v-slot="{ msg }">{{ msg }}</child>` ,
259+ components : {
260+ child : {
261+ compatConfig : { RENDER_FUNCTION : false } ,
262+ render ( ) {
263+ slots = this . $scopedSlots
264+ }
263265 }
264266 }
265- }
266- } ) . $mount ( )
267+ } ) . $mount ( )
267268
268- expect ( slots ! . default ! ( { msg : 'hi' } ) ) . toMatchObject ( [
269- {
270- type : Text ,
271- children : 'hi'
272- }
273- ] )
269+ expect ( slots ! . default ! ( { msg : 'hi' } ) ) . toMatchObject ( [
270+ {
271+ type : Text ,
272+ children : 'hi'
273+ }
274+ ] )
274275
275- expect (
276- deprecationData [ DeprecationTypes . INSTANCE_SCOPED_SLOTS ] . message
277- ) . toHaveBeenWarned ( )
276+ expect (
277+ deprecationData [ DeprecationTypes . INSTANCE_SCOPED_SLOTS ] . message
278+ ) . toHaveBeenWarned ( )
279+ } )
280+
281+ test ( 'should not include legacy slot usage in $scopedSlots' , ( ) => {
282+ let normalSlots : Slots
283+ let scopedSlots : Slots
284+ new Vue ( {
285+ template : `<child><div>default</div></child>` ,
286+ components : {
287+ child : {
288+ compatConfig : { RENDER_FUNCTION : false } ,
289+ render ( ) {
290+ normalSlots = this . $slots
291+ scopedSlots = this . $scopedSlots
292+ }
293+ }
294+ }
295+ } ) . $mount ( )
296+
297+ expect ( 'default' in normalSlots ! ) . toBe ( true )
298+ expect ( 'default' in scopedSlots ! ) . toBe ( false )
299+
300+ expect (
301+ deprecationData [ DeprecationTypes . INSTANCE_SCOPED_SLOTS ] . message
302+ ) . toHaveBeenWarned ( )
303+ } )
278304} )
279305
280306test ( 'INSTANCE_ATTR_CLASS_STYLE' , ( ) => {
0 commit comments