Skip to content

Commit 1af0601

Browse files
committed
cover warning component context
1 parent 38ee967 commit 1af0601

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/unit/specs/util/debug_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var _ = require('src/util')
2+
var Vue = require('src')
23
var config = require('src/config')
34
var warnPrefix = '[Vue warn]: '
45

@@ -15,6 +16,15 @@ if (typeof console !== 'undefined') {
1516
expect(console.error).toHaveBeenCalledWith(warnPrefix + 'oops')
1617
})
1718

19+
it('format component name', function () {
20+
config.silent = false
21+
_.warn.and.callThrough()
22+
_.warn('oops', new Vue({ name: 'hi' }))
23+
expect(console.error).toHaveBeenCalledWith(warnPrefix + 'oops (found in component: <hi>)')
24+
_.warn('oops', { name: 'ho' })
25+
expect(console.error).toHaveBeenCalledWith(warnPrefix + 'oops (found in component: <ho>)')
26+
})
27+
1828
it('not warn when silent is ture', function () {
1929
config.silent = true
2030
_.warn.and.callThrough()

0 commit comments

Comments
 (0)