Skip to content

Cannot get element inserted by v-html if the parent is the same kind of element #1828

Open
@dospunk

Description

@dospunk

Subject of the issue

I am trying to test a component where I have a span element with v-html such that the output looks something like this:

<span><span class="bold">12</span> years old</span>

I have confirmed that this works both in the browser and by printing out the .html() of the wrapper containing the first span. However, I cannot access the child span through any means. .findAll(span') only returns a wrapper for the parent span,

Steps to reproduce

I've created a simple example here: https://github.com/dospunk/vue-test-utils-bug

Expected behaviour

Content inserted by v-html should be accessible even if it starts with the same HTML tag as its parent

Actual behaviour

Content inserted by v-html is invisible to get(), find(), and findAll() if it starts with the same HTML tag as its parent

Possible Solution

I can work around this by selecting the parent and using .html(), but this keeps me from using most of the tools provided when testing that inserted content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions