Skip to content
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

Error with svg in v13.4.1 #1271

Closed
ja1984 opened this issue Feb 23, 2024 · 3 comments · Fixed by #1276
Closed

Error with svg in v13.4.1 #1271

ja1984 opened this issue Feb 23, 2024 · 3 comments · Fixed by #1276
Assignees
Labels
bug Something isn't working

Comments

@ja1984
Copy link

ja1984 commented Feb 23, 2024

Describe the bug
There seems to be an issue with finding svgs in v13.4.1 We have multiple tests that have been running just fine, but after updating to v13.4.1 for some reason one of our tests fails.

The code generated:

<td data-v-d8968c14="">
            <div data-v-d8968c14="" data-balloon="Active" class="tooltip-active" data-balloon-pos="up"><svg data-v-d8968c14="" class="svg-inline--fa fa-circle no-status success" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-test-id="active-collection">
                <path class="" fill="currentColor" d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"></path>
              </svg></div>
          </td>

Our expect
expect(wrapper.find('svg.success').exists()).toBe(true);

I tried with .success only and it succeeded, then tried with only svg and it failed. Downgrading back to 13.3.8 and all tests work again.

@ja1984 ja1984 added the bug Something isn't working label Feb 23, 2024
@kaderson
Copy link

kaderson commented Feb 23, 2024

@capricorn86
I also have the same problem, when I try to retrieve the svg and path by doing document.body.querySelector('svg') it returns null same even when I try to retrieve the path.
With the previous version it worked correctly.
@ja1984 did you solve it in any particular way?

@kaderson
Copy link

hii @capricorn86 this is my code, there is a bug with this version v13.4.1, I can't get the value of svg, path when I do it:```
const window = new Window()
const document = window.document

document.body.innerHTML = makerSvg
const bodyElement = document.querySelector('body')
const svgElement = bodyElement.querySelector('svg') // return null
const pathElement = svgElement.querySelector('path') // return null

```

@capricorn86 capricorn86 self-assigned this Feb 25, 2024
@capricorn86 capricorn86 linked a pull request Feb 25, 2024 that will close this issue
capricorn86 added a commit that referenced this issue Feb 25, 2024
fix: [#1271] Adds unit test for Vue component with SVG
@capricorn86
Copy link
Owner

Thank you for reporting @ja1984 and @kaderson! 🙂

The problem should be fixed now:
https://github.com/capricorn86/happy-dom/releases/tag/v13.5.1

I also added a unit test for Vue here:
https://github.com/capricorn86/happy-dom/releases/tag/v13.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants