Skip to content

Commit a46b1c4

Browse files
authored
test: add test (#1169)
1 parent f8e10c5 commit a46b1c4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/html.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,21 @@ describe('html', () => {
9898
const foo = wrapper.findComponent(Foo)
9999
expect(foo.html()).toEqual('<div class="Foo">FOO</div>')
100100
})
101+
102+
it('get component from within root fragments', () => {
103+
const RegularComponent = {
104+
name: 'RegularComponent',
105+
template: '<span>hello world</span>'
106+
}
107+
const ComponentWithRootFragments = {
108+
name: 'ComponentWithRootFragments',
109+
template: '<regular-component /><div>bye bye</div>',
110+
components: { RegularComponent }
111+
}
112+
const wrapper = mount(ComponentWithRootFragments)
113+
const regular = wrapper.getComponent(RegularComponent)
114+
115+
expect(regular.vm.$options.name).toBe('RegularComponent')
116+
expect(regular.html()).toMatchInlineSnapshot(`"<span>hello world</span>"`)
117+
})
101118
})

0 commit comments

Comments
 (0)