Commit 7bc2ec58 authored by Tom Quirk's avatar Tom Quirk

Use fixture for integration helpHtml spec

parent de1567a7
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { mockIntegrationProps } from 'jest/integrations/edit/mock_data'; import { mockIntegrationProps } from 'jest/integrations/edit/mock_data';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { setHTMLFixture } from 'helpers/fixtures';
import { createStore } from '~/integrations/edit/store'; import { createStore } from '~/integrations/edit/store';
import IntegrationForm from '~/integrations/edit/components/integration_form.vue'; import IntegrationForm from '~/integrations/edit/components/integration_form.vue';
import OverrideDropdown from '~/integrations/edit/components/override_dropdown.vue'; import OverrideDropdown from '~/integrations/edit/components/override_dropdown.vue';
...@@ -296,18 +297,22 @@ describe('IntegrationForm', () => { ...@@ -296,18 +297,22 @@ describe('IntegrationForm', () => {
}); });
describe('with `helpHtml` prop', () => { describe('with `helpHtml` prop', () => {
const mockTestId = 'jest-helpHtml-test'; const mockTestId = 'jest-help-html-test';
const mockHelpHtml = document.createElement('div');
mockHelpHtml.setAttribute('data-testid', mockTestId);
mockHelpHtml.appendChild(document.createElement('svg'));
const mockHelpHtmlContainer = document.createElement('div'); setHTMLFixture(`
mockHelpHtmlContainer.appendChild(mockHelpHtml); <div data-testid="${mockTestId}">
<svg class="gl-icon">
<use></use>
</svg>
</div>
`);
it('renders `helpHtml`', async () => { it('renders `helpHtml`', async () => {
const mockHelpHtml = document.querySelector(`[data-testid="${mockTestId}"]`);
createComponent({ createComponent({
props: { props: {
helpHtml: mockHelpHtmlContainer.innerHTML, helpHtml: mockHelpHtml.outerHTML,
}, },
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment