Using find({ref: '...'})
to target an Element
logs a deprecation warning
#1931
Labels
find({ref: '...'})
to target an Element
logs a deprecation warning
#1931
Subject of the issue
Trying to find an
Element
by itsref
gives a deprecation warning.Steps to reproduce
Consider this component:
If I want to find the "child" element, I'd like to be able to write:
However, if I do this, then I get a deprecation warning, because my selector isn't a
DOM_SELECTOR
(it's aREF_SELECTOR
).On the other hand, if I do what the deprecation warning suggests and use
findComponent()
, then the test fails, becausefindAllComponents()
filters forisVueWrapper
, which fails for anElement
.Expected behaviour
I should be able to use
find({ref: ''})
to target anElement
without a deprecation warning, or usefindComponent({ref: ''})
, as suggested.Actual behaviour
I get deprecation errors in my tests.
Possible Solution
The obvious workaround is to not use a
ref
to target theElement
, but it's not ideal, since aref
is a nice, syntactic non-style-based way of targeting an element for testing, which aligns with Vue's own syntax (as opposed to adding eg adata-test
attribute or similar).The text was updated successfully, but these errors were encountered: