Przeglądaj źródła

add asset resolution warning tests

Evan You 10 lat temu
rodzic
commit
ed10dcf293

+ 8 - 0
test/unit/features/filter/filter.spec.js

@@ -88,4 +88,12 @@ describe('Filters', () => {
     }).$mount()
     expect(vm.$el.textContent).toBe('3,2,1')
   })
+
+  it('warn non-existent', () => {
+    new Vue({
+      template: '<div>{{ msg | upper }}</div>',
+      data: { msg: 'foo' }
+    }).$mount()
+    expect('Failed to resolve filter: upper').toHaveBeenWarned()
+  })
 })

+ 7 - 0
test/unit/features/options/components.spec.js

@@ -73,4 +73,11 @@ describe('Options components', () => {
     })
     expect('Do not use built-in or reserved HTML elements as component').toHaveBeenWarned()
   })
+
+  it('warn non-existent', () => {
+    new Vue({
+      template: '<test></test>'
+    }).$mount()
+    expect('Unknown custom element: <test>').toHaveBeenWarned()
+  })
 })

+ 7 - 0
test/unit/features/options/directives.spec.js

@@ -89,4 +89,11 @@ describe('Options directives', () => {
       expect(spy).toHaveBeenCalledWith('bar', 'foo')
     }).then(done)
   })
+
+  it('warn non-existent', () => {
+    new Vue({
+      template: '<div v-test="a"></div>'
+    }).$mount()
+    expect('Failed to resolve directive: test').toHaveBeenWarned()
+  })
 })