--- /dev/null
+import { createVaporApp, template } from '../../src'
+
+describe('vCloak', () => {
+ test('should be removed after mount', () => {
+ const root = document.createElement('div')
+ root.setAttribute('v-cloak', '')
+ createVaporApp({
+ setup() {
+ expect(root.hasAttribute('v-cloak')).toBe(true)
+ expect(root.hasAttribute('data-v-app')).toBe(false)
+ return template(`<div></div>`)()
+ },
+ }).mount(root)
+ expect(root.hasAttribute('v-cloak')).toBe(false)
+ expect(root.hasAttribute('data-v-app')).toBe(true)
+ })
+})
const mount = app.mount
app.mount = (container, ...args: any[]) => {
container = normalizeContainer(container) as ParentNode
- return mount(container, ...args)
+ const proxy = mount(container, ...args)
+ if (container instanceof Element) {
+ container.removeAttribute('v-cloak')
+ container.setAttribute('data-v-app', '')
+ }
+ return proxy
}
}