]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(runtime-core): test app API warnings (#2079)
authoredison <daiwei521@126.com>
Tue, 15 Sep 2020 01:48:38 +0000 (09:48 +0800)
committerGitHub <noreply@github.com>
Tue, 15 Sep 2020 01:48:38 +0000 (21:48 -0400)
packages/runtime-core/__tests__/apiCreateApp.spec.ts

index c3be3476c2c09bbd08ac2c67eb3e7c2ce1a95bda..47e0eb6fa4f5ae783040467ef824a026040f3bfd 100644 (file)
@@ -58,6 +58,11 @@ describe('api: createApp', () => {
 
     const root = nodeOps.createElement('div')
     const app = createApp(Comp)
+
+    // warning
+    app.unmount(root)
+    expect(`that is not mounted`).toHaveBeenWarned()
+
     app.mount(root)
 
     app.unmount(root)
@@ -92,6 +97,11 @@ describe('api: createApp', () => {
     app.mount(root)
     expect(serializeInner(root)).toBe(`3,2`)
     expect('[Vue warn]: injection "__proto__" not found.').toHaveBeenWarned()
+
+    const app2 = createApp(Root)
+    app2.provide('bar', 1)
+    app2.provide('bar', 2)
+    expect(`App already provides property with key "bar".`).toHaveBeenWarned()
   })
 
   test('component', () => {