You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
findComponent(Func).element doesn’t contain the innerHTML I expected, it is a whitespace Text {} node, so text() is empty.
If the functional component has a root element this problem is not present.
wrapper.findComponent(Func).element.parentNode.children[0].textContent contains the expected answer! Because it manages to reach the HTMLElement node when invoking children, it skips the empty whitespace Text {} node.
miguelrincon
changed the title
Bug: findComponent() does not return functional component when they are defined as arrays
Bug: findComponent() does not return functional component's content when they are defined as arrays
Dec 17, 2024
Describe the bug
The result of
find(MyFunctionalComponent).text()
is incorrect when finding a functional component that is defined as an array.findComponent(Func).element
doesn’t contain theinnerHTML
I expected, it is a whitespaceText {}
node, so text() is empty.wrapper.findComponent(Func).element.parentNode.children[0].textContent
contains the expected answer! Because it manages to reach theHTMLElement
node when invokingchildren
, it skips the empty whitespaceText {}
node.To Reproduce
https://stackblitz.com/edit/github-f5gb9nta?file=src%2F__tests__%2Ffunctional.spec.ts&view=editor
Expected behavior
Any
text()
orhtml()
check, works as expected.Related information:
Additional context
The text was updated successfully, but these errors were encountered: