File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1+ import { createVaporApp , template } from '../../src'
2+
3+ describe ( 'vCloak' , ( ) => {
4+ test ( 'should be removed after mount' , ( ) => {
5+ const root = document . createElement ( 'div' )
6+ root . setAttribute ( 'v-cloak' , '' )
7+ createVaporApp ( {
8+ setup ( ) {
9+ expect ( root . hasAttribute ( 'v-cloak' ) ) . toBe ( true )
10+ expect ( root . hasAttribute ( 'data-v-app' ) ) . toBe ( false )
11+ return template ( `<div></div>` ) ( )
12+ } ,
13+ } ) . mount ( root )
14+ expect ( root . hasAttribute ( 'v-cloak' ) ) . toBe ( false )
15+ expect ( root . hasAttribute ( 'data-v-app' ) ) . toBe ( true )
16+ } )
17+ } )
Original file line number Diff line number Diff line change @@ -94,7 +94,12 @@ function postPrepareApp(app: App) {
9494 const mount = app . mount
9595 app . mount = ( container , ...args : any [ ] ) => {
9696 container = normalizeContainer ( container ) as ParentNode
97- return mount ( container , ...args )
97+ const proxy = mount ( container , ...args )
98+ if ( container instanceof Element ) {
99+ container . removeAttribute ( 'v-cloak' )
100+ container . setAttribute ( 'data-v-app' , '' )
101+ }
102+ return proxy
98103 }
99104}
100105
You can’t perform that action at this time.
0 commit comments