|
|
@ -1,4 +1,5 @@ |
|
|
|
import Vue from 'vue' |
|
|
|
import { formatComponentName } from 'core/util/debug' |
|
|
|
|
|
|
|
const components = createErrorTestComponents() |
|
|
|
|
|
|
@ -102,26 +103,25 @@ describe('Error handling', () => { |
|
|
|
}) |
|
|
|
|
|
|
|
it('properly format component names', () => { |
|
|
|
const format = Vue.util.formatComponentName |
|
|
|
const vm = new Vue() |
|
|
|
expect(format(vm)).toBe('<Root>') |
|
|
|
expect(formatComponentName(vm)).toBe('<Root>') |
|
|
|
|
|
|
|
vm.$root = null |
|
|
|
vm.$options.name = 'hello-there' |
|
|
|
expect(format(vm)).toBe('<HelloThere>') |
|
|
|
expect(formatComponentName(vm)).toBe('<HelloThere>') |
|
|
|
|
|
|
|
vm.$options.name = null |
|
|
|
vm.$options._componentTag = 'foo-bar-1' |
|
|
|
expect(format(vm)).toBe('<FooBar1>') |
|
|
|
expect(formatComponentName(vm)).toBe('<FooBar1>') |
|
|
|
|
|
|
|
vm.$options._componentTag = null |
|
|
|
vm.$options.__file = '/foo/bar/baz/SomeThing.vue' |
|
|
|
expect(format(vm)).toBe(`<SomeThing> at ${vm.$options.__file}`) |
|
|
|
expect(format(vm, false)).toBe('<SomeThing>') |
|
|
|
expect(formatComponentName(vm)).toBe(`<SomeThing> at ${vm.$options.__file}`) |
|
|
|
expect(formatComponentName(vm, false)).toBe('<SomeThing>') |
|
|
|
|
|
|
|
vm.$options.__file = 'C:\\foo\\bar\\baz\\windows_file.vue' |
|
|
|
expect(format(vm)).toBe(`<WindowsFile> at ${vm.$options.__file}`) |
|
|
|
expect(format(vm, false)).toBe('<WindowsFile>') |
|
|
|
expect(formatComponentName(vm)).toBe(`<WindowsFile> at ${vm.$options.__file}`) |
|
|
|
expect(formatComponentName(vm, false)).toBe('<WindowsFile>') |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|