Commit ba765c13 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'find-migrate-ee-iterations' into 'master'

Replace usage of find/findAll in ee/spec/frontend/iterations

See merge request gitlab-org/gitlab!78648
parents 5b3d25fa 743c560d
...@@ -26,7 +26,7 @@ describe('Iteration Breadcrumb', () => { ...@@ -26,7 +26,7 @@ describe('Iteration Breadcrumb', () => {
const cadenceId = 1234; const cadenceId = 1234;
const iterationId = 4567; const iterationId = 4567;
const findBreadcrumb = () => wrapper.find(GlBreadcrumb); const findBreadcrumb = () => wrapper.findComponent(GlBreadcrumb);
const waitForApollo = async () => { const waitForApollo = async () => {
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
...@@ -101,7 +101,7 @@ describe('Iteration Breadcrumb', () => { ...@@ -101,7 +101,7 @@ describe('Iteration Breadcrumb', () => {
it('finds GlIcon', () => { it('finds GlIcon', () => {
mountComponent(shallowMount); mountComponent(shallowMount);
expect(findBreadcrumb().find(GlIcon).exists()).toBe(true); expect(findBreadcrumb().findComponent(GlIcon).exists()).toBe(true);
}); });
}); });
......
...@@ -264,7 +264,7 @@ describe('Iteration cadence list item', () => { ...@@ -264,7 +264,7 @@ describe('Iteration cadence list item', () => {
}); });
it('hides dropdown and delete button', () => { it('hides dropdown and delete button', () => {
expect(wrapper.find(GlDropdown).exists()).toBe(false); expect(wrapper.findComponent(GlDropdown).exists()).toBe(false);
}); });
}); });
...@@ -278,7 +278,7 @@ describe('Iteration cadence list item', () => { ...@@ -278,7 +278,7 @@ describe('Iteration cadence list item', () => {
}); });
it('shows delete button', () => { it('shows delete button', () => {
expect(wrapper.find(GlDropdown).exists()).toBe(true); expect(wrapper.findComponent(GlDropdown).exists()).toBe(true);
}); });
it('opens confirmation modal to delete cadence', () => { it('opens confirmation modal to delete cadence', () => {
...@@ -288,7 +288,7 @@ describe('Iteration cadence list item', () => { ...@@ -288,7 +288,7 @@ describe('Iteration cadence list item', () => {
}); });
it('emits delete-cadence event with cadence ID', () => { it('emits delete-cadence event with cadence ID', () => {
wrapper.find(GlModal).vm.$emit('ok'); wrapper.findComponent(GlModal).vm.$emit('ok');
expect(wrapper.emitted('delete-cadence')).toEqual([[cadence.id]]); expect(wrapper.emitted('delete-cadence')).toEqual([[cadence.id]]);
}); });
...@@ -298,13 +298,13 @@ describe('Iteration cadence list item', () => { ...@@ -298,13 +298,13 @@ describe('Iteration cadence list item', () => {
it('hides dropdown when canEditCadence is false', async () => { it('hides dropdown when canEditCadence is false', async () => {
await createComponent({ canEditCadence: false }); await createComponent({ canEditCadence: false });
expect(wrapper.find(GlDropdown).exists()).toBe(false); expect(wrapper.findComponent(GlDropdown).exists()).toBe(false);
}); });
it('shows dropdown when canEditCadence is true', async () => { it('shows dropdown when canEditCadence is true', async () => {
await createComponent({ canEditCadence: true }); await createComponent({ canEditCadence: true });
expect(wrapper.find(GlDropdown).exists()).toBe(true); expect(wrapper.findComponent(GlDropdown).exists()).toBe(true);
}); });
it.each([ it.each([
......
...@@ -77,7 +77,7 @@ describe('Iteration Form', () => { ...@@ -77,7 +77,7 @@ describe('Iteration Form', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findPageTitle = () => wrapper.find({ ref: 'pageTitle' }); const findPageTitle = () => wrapper.findComponent({ ref: 'pageTitle' });
const findTitle = () => wrapper.find('#iteration-title'); const findTitle = () => wrapper.find('#iteration-title');
const findDescription = () => wrapper.find('#iteration-description'); const findDescription = () => wrapper.find('#iteration-description');
const findStartDate = () => wrapper.find('#iteration-start-date'); const findStartDate = () => wrapper.find('#iteration-start-date');
......
...@@ -52,7 +52,7 @@ describe('Iteration Form', () => { ...@@ -52,7 +52,7 @@ describe('Iteration Form', () => {
wrapper = null; wrapper = null;
}); });
const findPageTitle = () => wrapper.find({ ref: 'pageTitle' }); const findPageTitle = () => wrapper.findComponent({ ref: 'pageTitle' });
const findTitle = () => wrapper.find('#iteration-title'); const findTitle = () => wrapper.find('#iteration-title');
const findDescription = () => wrapper.find('#iteration-description'); const findDescription = () => wrapper.find('#iteration-description');
const findStartDate = () => wrapper.find('#iteration-start-date'); const findStartDate = () => wrapper.find('#iteration-start-date');
...@@ -65,7 +65,7 @@ describe('Iteration Form', () => { ...@@ -65,7 +65,7 @@ describe('Iteration Form', () => {
it('renders a form', () => { it('renders a form', () => {
createComponent(); createComponent();
expect(wrapper.find(GlForm).exists()).toBe(true); expect(wrapper.findComponent(GlForm).exists()).toBe(true);
}); });
describe('New iteration', () => { describe('New iteration', () => {
......
...@@ -35,9 +35,9 @@ describe('Iterations report', () => { ...@@ -35,9 +35,9 @@ describe('Iterations report', () => {
}; };
const labelsFetchPath = '/labels.json'; const labelsFetchPath = '/labels.json';
const findTopbar = () => wrapper.find({ ref: 'topbar' }); const findTopbar = () => wrapper.findComponent({ ref: 'topbar' });
const findTitle = () => wrapper.find({ ref: 'title' }); const findTitle = () => wrapper.findComponent({ ref: 'title' });
const findDescription = () => wrapper.find({ ref: 'description' }); const findDescription = () => wrapper.findComponent({ ref: 'description' });
const findActionsDropdown = () => wrapper.find('[data-testid="actions-dropdown"]'); const findActionsDropdown = () => wrapper.find('[data-testid="actions-dropdown"]');
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
......
...@@ -22,9 +22,9 @@ describe('Iterations report', () => { ...@@ -22,9 +22,9 @@ describe('Iterations report', () => {
labelsFetchPath: '/gitlab-org/gitlab-test/-/labels.json?include_ancestor_groups=true', labelsFetchPath: '/gitlab-org/gitlab-test/-/labels.json?include_ancestor_groups=true',
}; };
const findTopbar = () => wrapper.find({ ref: 'topbar' }); const findTopbar = () => wrapper.findComponent({ ref: 'topbar' });
const findTitle = () => wrapper.find({ ref: 'title' }); const findTitle = () => wrapper.findComponent({ ref: 'title' });
const findDescription = () => wrapper.find({ ref: 'description' }); const findDescription = () => wrapper.findComponent({ ref: 'description' });
const findActionsDropdown = () => wrapper.find('[data-testid="actions-dropdown"]'); const findActionsDropdown = () => wrapper.find('[data-testid="actions-dropdown"]');
const clickEditButton = () => { const clickEditButton = () => {
findActionsDropdown().vm.$emit('click'); findActionsDropdown().vm.$emit('click');
......
...@@ -6,7 +6,7 @@ import IterationsList from 'ee/iterations/components/iterations_list.vue'; ...@@ -6,7 +6,7 @@ import IterationsList from 'ee/iterations/components/iterations_list.vue';
describe('Iterations list', () => { describe('Iterations list', () => {
let wrapper; let wrapper;
const findGlLink = () => wrapper.find(GlLink); const findGlLink = () => wrapper.findComponent(GlLink);
const mountComponent = (propsData = { iterations: [] }) => { const mountComponent = (propsData = { iterations: [] }) => {
wrapper = shallowMount(IterationsList, { wrapper = shallowMount(IterationsList, {
......
...@@ -36,8 +36,8 @@ describe('Iterations', () => { ...@@ -36,8 +36,8 @@ describe('Iterations', () => {
loading: true, loading: true,
}); });
expect(wrapper.find(GlLoadingIcon).exists()).toBeTruthy(); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBeTruthy();
expect(wrapper.find(IterationsList).exists()).toBeFalsy(); expect(wrapper.findComponent(IterationsList).exists()).toBeFalsy();
}); });
it('shows iterations list when not loading', () => { it('shows iterations list when not loading', () => {
...@@ -45,8 +45,8 @@ describe('Iterations', () => { ...@@ -45,8 +45,8 @@ describe('Iterations', () => {
loading: false, loading: false,
}); });
expect(wrapper.find(GlLoadingIcon).exists()).toBeFalsy(); expect(wrapper.findComponent(GlLoadingIcon).exists()).toBeFalsy();
expect(wrapper.find(IterationsList).exists()).toBeTruthy(); expect(wrapper.findComponent(IterationsList).exists()).toBeTruthy();
}); });
it('sets computed state from tabIndex', () => { it('sets computed state from tabIndex', () => {
...@@ -64,7 +64,7 @@ describe('Iterations', () => { ...@@ -64,7 +64,7 @@ describe('Iterations', () => {
}); });
describe('pagination', () => { describe('pagination', () => {
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.findComponent(GlPagination);
const setPage = (page) => { const setPage = (page) => {
findPagination().vm.$emit('input', page); findPagination().vm.$emit('input', page);
return findPagination().vm.$nextTick(); return findPagination().vm.$nextTick();
...@@ -131,7 +131,7 @@ describe('Iterations', () => { ...@@ -131,7 +131,7 @@ describe('Iterations', () => {
afterCursor: 'last-item', afterCursor: 'last-item',
}); });
wrapper.find(GlTabs).vm.$emit('activate-tab', 2); wrapper.findComponent(GlTabs).vm.$emit('activate-tab', 2);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
...@@ -195,7 +195,7 @@ describe('Iterations', () => { ...@@ -195,7 +195,7 @@ describe('Iterations', () => {
}); });
it('tab shows error in alert', () => { it('tab shows error in alert', () => {
expect(wrapper.find(GlAlert).text()).toContain('Oh no!'); expect(wrapper.findComponent(GlAlert).text()).toContain('Oh no!');
}); });
}); });
}); });
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