|
|
@@ -1,5 +1,5 @@
|
|
|
import Vue from 'vue'
|
|
|
-import { formatComponentName } from 'core/util/debug'
|
|
|
+import { formatComponentName, warn } from 'core/util/debug'
|
|
|
|
|
|
describe('Debug utilities', () => {
|
|
|
it('properly format component names', () => {
|
|
|
@@ -80,4 +80,38 @@ found in
|
|
|
<Root>`
|
|
|
).toHaveBeenWarned()
|
|
|
})
|
|
|
+
|
|
|
+ describe('warn', () => {
|
|
|
+ const msg = 'message'
|
|
|
+ const vm = new Vue()
|
|
|
+
|
|
|
+ it('calls warnHandler if warnHandler is set', () => {
|
|
|
+ Vue.config.warnHandler = jasmine.createSpy()
|
|
|
+
|
|
|
+ warn(msg, vm)
|
|
|
+
|
|
|
+ expect(Vue.config.warnHandler).toHaveBeenCalledWith(msg, vm, jasmine.any(String))
|
|
|
+
|
|
|
+ Vue.config.warnHandler = null
|
|
|
+ })
|
|
|
+
|
|
|
+ it('calls console.error if silent is false', () => {
|
|
|
+ Vue.config.silent = false
|
|
|
+
|
|
|
+ warn(msg, vm)
|
|
|
+
|
|
|
+ expect(msg).toHaveBeenWarned()
|
|
|
+ expect(console.error).toHaveBeenCalled()
|
|
|
+ })
|
|
|
+
|
|
|
+ it('does not call console.error if silent is true', () => {
|
|
|
+ Vue.config.silent = true
|
|
|
+
|
|
|
+ warn(msg, vm)
|
|
|
+
|
|
|
+ expect(console.error).not.toHaveBeenCalled()
|
|
|
+
|
|
|
+ Vue.config.silent = false
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|