Skip to content

find(Component).exists() always returns true #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BeniRupp opened this issue Jul 6, 2018 · 1 comment
Closed

find(Component).exists() always returns true #810

BeniRupp opened this issue Jul 6, 2018 · 1 comment
Labels

Comments

@BeniRupp
Copy link

BeniRupp commented Jul 6, 2018

Version

1.0.0-beta.20

Reproduction link

https://github.com/BeniRupp/vue-test-utils-getting-started

Steps to reproduce

Run the tests using npm test.

What is expected?

The hello component is not be rendered because of v-if="false", therefore the wrapper.find(Hello).exists() should return false. Furthermore wrapper.findAll(Hello).length should be 0.

What is actually happening?

wrapper.find(Hello).exists() returns true and wrapper.findAll(Hello).length returns 2. Furthermore the HTML of the Hello component is the same as the HTML of the wrapper. Whereas wrapper !== wrapper.find(Hello).

When using wrapper.find('.hello-message') the expect method returns false and findAll() did not find any Hello component as expected.


For me it seems to be a bug of the find(Component) method when using mount(). If I use shallowMount() the find method will work as expected.

The issue can also be reproduced using vue-test-utils 1.0.0-beta.13.

@eddyerburgh
Copy link
Member

Thanks for the bug report.

This is a duplicate of #744, and will be fixed in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants