11import Vue from '@vue/compat'
22import { effect , isReactive } from '@vue/reactivity'
3- import { nextTick } from '@vue/runtime-core'
3+ import { h , nextTick } from '@vue/runtime-core'
44import {
55 DeprecationTypes ,
66 deprecationData ,
@@ -454,19 +454,51 @@ test('post-facto global asset registration should affect apps created via create
454454 template : '<foo/>'
455455 } )
456456 Vue . component ( 'foo' , { template : 'foo' } )
457- const vm = app . mount ( document . createElement ( 'div' ) ) as any ;
457+ const vm = app . mount ( document . createElement ( 'div' ) ) as any
458458 expect ( vm . $el . textContent ) . toBe ( 'foo' )
459459 delete singletonApp . _context . components . foo
460460} )
461461
462462test ( 'local asset registration should not affect other local apps' , ( ) => {
463- const app1 = createApp ( { } ) ;
464- const app2 = createApp ( { } ) ;
463+ const app1 = createApp ( { } )
464+ const app2 = createApp ( { } )
465465
466- app1 . component ( 'foo' , { } ) ;
467- app2 . component ( 'foo' , { } ) ;
466+ app1 . component ( 'foo' , { } )
467+ app2 . component ( 'foo' , { } )
468468
469469 expect (
470470 `Component "foo" has already been registered in target app`
471471 ) . not . toHaveBeenWarned ( )
472- } )
472+ } )
473+
474+ test ( 'local app-level mixin registration should not affect other local apps' , ( ) => {
475+ const app1 = createApp ( { render : ( ) => h ( 'div' ) } )
476+ const app2 = createApp ( { } )
477+
478+ const mixin = { created : jest . fn ( ) }
479+ app1 . mixin ( mixin )
480+ app2 . mixin ( mixin )
481+
482+ expect ( `Mixin has already been applied` ) . not . toHaveBeenWarned ( )
483+
484+ app1 . mount ( document . createElement ( 'div' ) )
485+ expect ( mixin . created ) . toHaveBeenCalledTimes ( 1 )
486+ } )
487+
488+ // #5699
489+ test ( 'local app config should not affect other local apps in v3 mode' , ( ) => {
490+ Vue . configureCompat ( { MODE : 3 } )
491+ const app1 = createApp ( {
492+ render : ( ) => h ( 'div' ) ,
493+ provide ( ) {
494+ return {
495+ test : 123
496+ }
497+ }
498+ } )
499+ app1 . config . globalProperties . test = ( ) => { }
500+ app1 . mount ( document . createElement ( 'div' ) )
501+
502+ const app2 = createApp ( { } )
503+ expect ( app2 . config . globalProperties . test ) . toBe ( undefined )
504+ } )
0 commit comments