feat(sfc): allow sfcs to recursively self-reference in template via name inferred from filename
e.g. A file named `FooBar.vue` can refer to itself as `<FooBar/>`. This gets rid of the need for the `name` option.
This commit is contained in:
@@ -70,6 +70,14 @@ describe('compiler: element transform', () => {
|
||||
expect(root.components).toContain(`Foo`)
|
||||
})
|
||||
|
||||
test('resolve implcitly self-referencing component', () => {
|
||||
const { root } = parseWithElementTransform(`<Example/>`, {
|
||||
filename: `/foo/bar/Example.vue?vue&type=template`
|
||||
})
|
||||
expect(root.helpers).toContain(RESOLVE_COMPONENT)
|
||||
expect(root.components).toContain(`_self`)
|
||||
})
|
||||
|
||||
test('static props', () => {
|
||||
const { node } = parseWithElementTransform(`<div id="foo" class="bar" />`)
|
||||
expect(node).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user