Skip to content

Commit

Permalink
Merge pull request #1276 from capricorn86/1271-error-with-svg-in-v1341
Browse files Browse the repository at this point in the history
fix: [#1271] Adds unit test for Vue component with SVG
  • Loading branch information
capricorn86 committed Feb 25, 2024
2 parents 8182be6 + 59cb26e commit f522225
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 0 deletions.
205 changes: 205 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/jest-environment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@radix-ui/react-select": "^1.2.2",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@vue/test-utils": "^2.4.4",
"@types/jest": "29.5.2",
"@types/node": "^16.11.7",
"@types/react": "^18.2.0",
Expand Down
20 changes: 20 additions & 0 deletions packages/jest-environment/test/vue/Vue.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createApp } from 'vue';
import { mount } from '@vue/test-utils';

describe('Vue', () => {
let appElement: Element;
Expand All @@ -25,4 +26,23 @@ describe('Vue', () => {
app.mount('#app');
expect(document.body.innerHTML).toBe('<div id="app" data-v-app="">Test</div>');
});

it('Component with SVG.', () => {
const MessageComponent = {
template: `
<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>
`,
props: ['msg']
};
const wrapper = mount(MessageComponent, {
propsData: {
msg: 'Hello world'
}
});
expect(wrapper.find('svg.success').exists()).toBe(true);
});
});

0 comments on commit f522225

Please sign in to comment.