Skip to content

Commit 6ed1472

Browse files
committed
test: add find test in shallow
1 parent b84ec9c commit 6ed1472

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/unit/specs/shallow.spec.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('shallow', () => {
7474
expect(info.called).to.equal(false)
7575
})
7676

77-
it('works correctly with find, contains, findAll, and is', () => {
77+
it('works correctly with find, contains, findAll, and is on unnamed components', () => {
7878
const TestComponent = {
7979
template: `
8080
<div>
@@ -87,10 +87,27 @@ describe('shallow', () => {
8787
}
8888
const wrapper = shallow(TestComponent)
8989
expect(wrapper.contains(ComponentWithoutName)).to.equal(true)
90-
expect(wrapper.find(ComponentWithoutName).is(ComponentWithoutName)).to.equal(true)
90+
expect(wrapper.find(ComponentWithoutName).exists()).to.equal(true)
9191
expect(wrapper.findAll(ComponentWithoutName).length).to.equal(1)
9292
})
9393

94+
it('works correctly with find, contains, findAll, and is on named components', () => {
95+
const TestComponent = {
96+
template: `
97+
<div>
98+
<a-component />
99+
</div>
100+
`,
101+
components: {
102+
AComponent: Component
103+
}
104+
}
105+
const wrapper = shallow(TestComponent)
106+
expect(wrapper.contains(Component)).to.equal(true)
107+
expect(wrapper.find(Component).exists()).to.equal(true)
108+
expect(wrapper.findAll(Component).length).to.equal(1)
109+
})
110+
94111
it('throws an error when the component fails to mount', () => {
95112
expect(() => shallow({
96113
template: '<div></div>',

0 commit comments

Comments
 (0)