Commit de4aac71 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'xanf-upgrade-vtu-to-v1' into 'master'

Upgrade @vue/test-utils to v1.1.2

See merge request gitlab-org/gitlab!50598
parents 47c39953 7af4dc13
...@@ -4,9 +4,9 @@ exports[`MergeRequestTable component template matches the snapshot 1`] = ` ...@@ -4,9 +4,9 @@ exports[`MergeRequestTable component template matches the snapshot 1`] = `
<table <table
aria-busy="false" aria-busy="false"
aria-colcount="7" aria-colcount="7"
aria-describedby="__BVID__59__caption_" aria-describedby="__BVID__36__caption_"
class="table b-table gl-table my-3 b-table-stacked-sm" class="table b-table gl-table my-3 b-table-stacked-sm"
id="__BVID__59" id="__BVID__36"
role="table" role="table"
> >
<!----> <!---->
......
...@@ -63,7 +63,7 @@ describe('Approvals ApproversSelect', () => { ...@@ -63,7 +63,7 @@ describe('Approvals ApproversSelect', () => {
...options, ...options,
propsData, propsData,
localVue, localVue,
attachToDocument: true, attachTo: document.body,
}); });
await waitForPromises(); await waitForPromises();
......
...@@ -34,7 +34,7 @@ describe('Branches Select', () => { ...@@ -34,7 +34,7 @@ describe('Branches Select', () => {
}, },
localVue, localVue,
store: new Vuex.Store(store), store: new Vuex.Store(store),
attachToDocument: true, attachTo: document.body,
}); });
await waitForPromises(); await waitForPromises();
......
...@@ -27,7 +27,7 @@ describe('EE Approvals MRRules', () => { ...@@ -27,7 +27,7 @@ describe('EE Approvals MRRules', () => {
wrapper = mount(localVue.extend(MRRules), { wrapper = mount(localVue.extend(MRRules), {
localVue, localVue,
store: new Vuex.Store(store), store: new Vuex.Store(store),
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -53,7 +53,7 @@ describe('User invites', () => { ...@@ -53,7 +53,7 @@ describe('User invites', () => {
beforeEach(() => { beforeEach(() => {
wrapper = mount(Component, { wrapper = mount(Component, {
propsData: { emails: [], docsPath: 'https://some.doc.path' }, propsData: { emails: [], docsPath: 'https://some.doc.path' },
attachToDocument: true, attachTo: document.body,
}); });
clickButton(); clickButton();
......
...@@ -77,7 +77,7 @@ describe('RelatedIssuableInput', () => { ...@@ -77,7 +77,7 @@ describe('RelatedIssuableInput', () => {
references: ['foo', 'bar'], references: ['foo', 'bar'],
}, },
// We need to attach to document, so that `document.activeElement` is properly set in jsdom // We need to attach to document, so that `document.activeElement` is properly set in jsdom
attachToDocument: true, attachTo: document.body,
}); });
wrapper.find('li').trigger('click'); wrapper.find('li').trigger('click');
......
...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = ` ...@@ -6,10 +6,10 @@ exports[`NetworkPolicyList component renders policies table 1`] = `
<table <table
aria-busy="false" aria-busy="false"
aria-colcount="3" aria-colcount="3"
aria-describedby="__BVID__432__caption_" aria-describedby="__BVID__333__caption_"
aria-multiselectable="false" aria-multiselectable="false"
class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single" class="table b-table gl-table table-hover b-table-stacked-md b-table-selectable b-table-select-single"
id="__BVID__432" id="__BVID__333"
role="table" role="table"
> >
<!----> <!---->
......
...@@ -24,7 +24,7 @@ describe('MrWidgetPipelineContainer', () => { ...@@ -24,7 +24,7 @@ describe('MrWidgetPipelineContainer', () => {
provide: { provide: {
...provide, ...provide,
}, },
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -2,7 +2,7 @@ export * from '@gitlab/ui'; ...@@ -2,7 +2,7 @@ export * from '@gitlab/ui';
/** /**
* The @gitlab/ui tooltip directive requires awkward and distracting set up in tests * The @gitlab/ui tooltip directive requires awkward and distracting set up in tests
* for components that use it (e.g., `attachToDocument: true` and `sync: true` passed * for components that use it (e.g., `attachTo: document.body` and `sync: true` passed
* to the `mount` helper from `vue-test-utils`). * to the `mount` helper from `vue-test-utils`).
* *
* This mock decouples those tests from the implementation, removing the need to set * This mock decouples those tests from the implementation, removing the need to set
......
...@@ -71,7 +71,7 @@ describe('BoardForm', () => { ...@@ -71,7 +71,7 @@ describe('BoardForm', () => {
mutate, mutate,
}, },
}, },
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -94,7 +94,7 @@ describe('BoardsSelector', () => { ...@@ -94,7 +94,7 @@ describe('BoardsSelector', () => {
weights: [], weights: [],
}, },
mocks: { $apollo }, mocks: { $apollo },
attachToDocument: true, attachTo: document.body,
}); });
wrapper.vm.$apollo.addSmartQuery = jest.fn((_, options) => { wrapper.vm.$apollo.addSmartQuery = jest.fn((_, options) => {
......
...@@ -17,7 +17,7 @@ describe('Ci variable modal', () => { ...@@ -17,7 +17,7 @@ describe('Ci variable modal', () => {
const createComponent = (method, options = {}) => { const createComponent = (method, options = {}) => {
store = createStore(); store = createStore();
wrapper = method(CiVariableModal, { wrapper = method(CiVariableModal, {
attachToDocument: true, attachTo: document.body,
stubs: { stubs: {
GlModal: ModalStub, GlModal: ModalStub,
}, },
......
...@@ -17,7 +17,7 @@ describe('Ci variable table', () => { ...@@ -17,7 +17,7 @@ describe('Ci variable table', () => {
store.state.isGroup = true; store.state.isGroup = true;
jest.spyOn(store, 'dispatch').mockImplementation(); jest.spyOn(store, 'dispatch').mockImplementation();
wrapper = mount(CiVariableTable, { wrapper = mount(CiVariableTable, {
attachToDocument: true, attachTo: document.body,
localVue, localVue,
store, store,
}); });
......
...@@ -19,7 +19,7 @@ describe('Deploy freeze modal', () => { ...@@ -19,7 +19,7 @@ describe('Deploy freeze modal', () => {
timezoneData: timezoneDataFixture, timezoneData: timezoneDataFixture,
}); });
wrapper = shallowMount(DeployFreezeModal, { wrapper = shallowMount(DeployFreezeModal, {
attachToDocument: true, attachTo: document.body,
stubs: { stubs: {
GlModal, GlModal,
}, },
......
...@@ -18,7 +18,7 @@ describe('Deploy freeze table', () => { ...@@ -18,7 +18,7 @@ describe('Deploy freeze table', () => {
}); });
jest.spyOn(store, 'dispatch').mockImplementation(); jest.spyOn(store, 'dispatch').mockImplementation();
wrapper = mount(DeployFreezeTable, { wrapper = mount(DeployFreezeTable, {
attachToDocument: true, attachTo: document.body,
localVue, localVue,
store, store,
}); });
......
...@@ -36,7 +36,7 @@ describe('Design reply form component', () => { ...@@ -36,7 +36,7 @@ describe('Design reply form component', () => {
it('textarea has focus after component mount', () => { it('textarea has focus after component mount', () => {
// We need to attach to document, so that `document.activeElement` is properly set in jsdom // We need to attach to document, so that `document.activeElement` is properly set in jsdom
createComponent({}, { attachToDocument: true }); createComponent({}, { attachTo: document.body });
expect(findTextarea().element).toEqual(document.activeElement); expect(findTextarea().element).toEqual(document.activeElement);
}); });
......
...@@ -10,7 +10,10 @@ exports[`Design management list item component when item appears in view after i ...@@ -10,7 +10,10 @@ exports[`Design management list item component when item appears in view after i
exports[`Design management list item component with notes renders item with multiple comments 1`] = ` exports[`Design management list item component with notes renders item with multiple comments 1`] = `
<router-link-stub <router-link-stub
ariacurrentvalue="page"
class="card gl-cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new" class="card gl-cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
event="click"
tag="a"
to="[object Object]" to="[object Object]"
> >
<div <div
...@@ -81,7 +84,10 @@ exports[`Design management list item component with notes renders item with mult ...@@ -81,7 +84,10 @@ exports[`Design management list item component with notes renders item with mult
exports[`Design management list item component with notes renders item with single comment 1`] = ` exports[`Design management list item component with notes renders item with single comment 1`] = `
<router-link-stub <router-link-stub
ariacurrentvalue="page"
class="card gl-cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new" class="card gl-cursor-pointer text-plain js-design-list-item design-list-item design-list-item-new"
event="click"
tag="a"
to="[object Object]" to="[object Object]"
> >
<div <div
......
...@@ -160,7 +160,7 @@ describe('Design management index page', () => { ...@@ -160,7 +160,7 @@ describe('Design management index page', () => {
localVue, localVue,
router, router,
stubs: { DesignDestroyer, ApolloMutation, VueDraggable, ...stubs }, stubs: { DesignDestroyer, ApolloMutation, VueDraggable, ...stubs },
attachToDocument: true, attachTo: document.body,
provide: { provide: {
projectPath: 'project-path', projectPath: 'project-path',
issueIid: '1', issueIid: '1',
......
...@@ -26,7 +26,7 @@ describe('Stacked column chart component', () => { ...@@ -26,7 +26,7 @@ describe('Stacked column chart component', () => {
stubs: { stubs: {
GlPopover: true, GlPopover: true,
}, },
attachToDocument: true, attachTo: document.body,
}); });
beforeEach(() => { beforeEach(() => {
......
...@@ -53,7 +53,7 @@ describe('Time series component', () => { ...@@ -53,7 +53,7 @@ describe('Time series component', () => {
stubs: { stubs: {
GlPopover: true, GlPopover: true,
}, },
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -11,7 +11,7 @@ const createMountedWrapper = (props = {}) => { ...@@ -11,7 +11,7 @@ const createMountedWrapper = (props = {}) => {
wrapper = mount(DuplicateDashboardForm, { wrapper = mount(DuplicateDashboardForm, {
propsData: { ...props }, propsData: { ...props },
// We need to attach to document, so that `document.activeElement` is properly set in jsdom // We need to attach to document, so that `document.activeElement` is properly set in jsdom
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -16,8 +16,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -16,8 +16,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
...props, ...props,
}, },
// attachToDocument is required for input/submit events // attachTo is required for input/submit events
attachToDocument: mountFn === mount, attachTo: mountFn === mount ? document.body : null,
}); });
}; };
......
...@@ -100,8 +100,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -100,8 +100,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
mutate: mockMutate, mutate: mockMutate,
}, },
}, },
// attachToDocument is required for input/submit events // attachTo is required for input/submit events
attachToDocument: mountFn === mount, attachTo: mountFn === mount ? document.body : null,
...options, ...options,
}); });
}; };
......
...@@ -20,7 +20,7 @@ describe('The DAG graph', () => { ...@@ -20,7 +20,7 @@ describe('The DAG graph', () => {
} }
wrapper = shallowMount(DagGraph, { wrapper = shallowMount(DagGraph, {
attachToDocument: true, attachTo: document.body,
propsData, propsData,
data() { data() {
return { return {
......
...@@ -26,7 +26,7 @@ describe('Pipelines filtered search', () => { ...@@ -26,7 +26,7 @@ describe('Pipelines filtered search', () => {
projectId: '21', projectId: '21',
params, params,
}, },
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -26,7 +26,7 @@ describe('Pipelines stage component', () => { ...@@ -26,7 +26,7 @@ describe('Pipelines stage component', () => {
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = mount(StageComponent, { wrapper = mount(StageComponent, {
attachToDocument: true, attachTo: document.body,
propsData: { propsData: {
...defaultProps, ...defaultProps,
...props, ...props,
......
...@@ -29,7 +29,7 @@ describe('sidebar assignees', () => { ...@@ -29,7 +29,7 @@ describe('sidebar assignees', () => {
}, },
}, },
// Attaching to document is required because this component emits something from the parent element :/ // Attaching to document is required because this component emits something from the parent element :/
attachToDocument: true, attachTo: document.body,
}); });
}; };
......
...@@ -58,8 +58,18 @@ Object.entries(jqueryMatchers).forEach(([matcherName, matcherFactory]) => { ...@@ -58,8 +58,18 @@ Object.entries(jqueryMatchers).forEach(([matcherName, matcherFactory]) => {
expect.extend(customMatchers); expect.extend(customMatchers);
// Tech debt issue TBD testUtilsConfig.deprecationWarningHandler = (method, message) => {
testUtilsConfig.logModifiedComponents = false; const ALLOWED_DEPRECATED_METHODS = [
// https://gitlab.com/gitlab-org/gitlab/-/issues/295679
'finding components with `find` or `get`',
// https://gitlab.com/gitlab-org/gitlab/-/issues/295680
'finding components with `findAll`',
];
if (!ALLOWED_DEPRECATED_METHODS.includes(method)) {
global.console.error(message);
}
};
Object.assign(global, { Object.assign(global, {
requestIdleCallback(cb) { requestIdleCallback(cb) {
......
...@@ -31,7 +31,7 @@ describe('ProjectSelector component', () => { ...@@ -31,7 +31,7 @@ describe('ProjectSelector component', () => {
showSearchErrorMessage: false, showSearchErrorMessage: false,
totalResults: searchResults.length, totalResults: searchResults.length,
}, },
attachToDocument: true, attachTo: document.body,
}); });
({ vm } = wrapper); ({ vm } = wrapper);
......
...@@ -18,7 +18,7 @@ describe('TooltipOnTruncate component', () => { ...@@ -18,7 +18,7 @@ describe('TooltipOnTruncate component', () => {
const createComponent = ({ propsData, ...options } = {}) => { const createComponent = ({ propsData, ...options } = {}) => {
wrapper = shallowMount(TooltipOnTruncate, { wrapper = shallowMount(TooltipOnTruncate, {
attachToDocument: true, attachTo: document.body,
propsData: { propsData: {
...propsData, ...propsData,
}, },
...@@ -44,7 +44,7 @@ describe('TooltipOnTruncate component', () => { ...@@ -44,7 +44,7 @@ describe('TooltipOnTruncate component', () => {
}, },
{ {
propsData: { ...propsData }, propsData: { ...propsData },
attachToDocument: true, attachTo: document.body,
...options, ...options,
}, },
); );
......
...@@ -19,7 +19,7 @@ describe('Tooltip directive', () => { ...@@ -19,7 +19,7 @@ describe('Tooltip directive', () => {
data: () => ({ tooltip: text }), data: () => ({ tooltip: text }),
template, template,
}, },
{ attachToDocument: true }, { attachTo: document.body },
); );
} }
......
...@@ -36,7 +36,7 @@ describe('validation directive', () => { ...@@ -36,7 +36,7 @@ describe('validation directive', () => {
`, `,
}; };
wrapper = shallowMount(component, { attachToDocument: true }); wrapper = shallowMount(component, { attachTo: document.body });
}; };
afterEach(() => { afterEach(() => {
......
...@@ -1423,10 +1423,10 @@ ...@@ -1423,10 +1423,10 @@
source-map "~0.6.1" source-map "~0.6.1"
vue-template-es2015-compiler "^1.9.0" vue-template-es2015-compiler "^1.9.0"
"@vue/test-utils@1.0.0-beta.30": "@vue/test-utils@1.1.2":
version "1.0.0-beta.30" version "1.1.2"
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.30.tgz#d5f26d1e2411fdb7fa7fdedb61b4b4ea4194c49d" resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.1.2.tgz#fdb487448dceefeaf3d01d465f7c836a3d666dbc"
integrity sha512-Wyvcha9fNk8+kzTDwb3xWGjPkCPzHSYSwKP6MplrPTG/auhqoad7JqUEceZLc6u7AU4km2pPQ8/m9s0RgCZ0NA== integrity sha512-utbIL7zn9c+SjhybPwh48lpWCiluFCbP1yyRNAy1fQsw/6hiNFioaWy05FoVAFIZXC5WwBf+5r4ypfM1j/nI4A==
dependencies: dependencies:
dom-event-types "^1.0.0" dom-event-types "^1.0.0"
lodash "^4.17.15" lodash "^4.17.15"
......
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