Commit a3e1a0d5 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'find-migrate-ee-misc-v4' into 'master'

Replace usage of find/findAll in misc ee components (4/5)

See merge request gitlab-org/gitlab!78653
parents 6c9ef6f4 5d207fe3
...@@ -45,10 +45,10 @@ describe('AddEditScheduleForm', () => { ...@@ -45,10 +45,10 @@ describe('AddEditScheduleForm', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findTimezoneDropdown = () => wrapper.find(GlDropdown); const findTimezoneDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownOptions = () => wrapper.findAllComponents(GlDropdownItem); const findDropdownOptions = () => wrapper.findAllComponents(GlDropdownItem);
const findTimezoneSearchBox = () => wrapper.find(GlSearchBoxByType); const findTimezoneSearchBox = () => wrapper.findComponent(GlSearchBoxByType);
const findScheduleName = () => wrapper.find(GlFormGroup); const findScheduleName = () => wrapper.findComponent(GlFormGroup);
it('renders form layout', () => { it('renders form layout', () => {
createComponent({ createComponent({
......
[{ [
{
"id": "gid://gitlab/IncidentManagement::OncallRotation/2", "id": "gid://gitlab/IncidentManagement::OncallRotation/2",
"name": "Rotation 242", "name": "Rotation 242",
"startsAt": "2021-01-13T11:04:56.333Z", "startsAt": "2021-01-13T11:04:56.333Z",
...@@ -180,65 +181,66 @@ ...@@ -180,65 +181,66 @@
} }
] ]
} }
},
{
"id": "gid://gitlab/IncidentManagement::OncallRotation/5",
"name": "Rotation 247",
"startsAt": "2021-01-06T10:04:56.333Z",
"endsAt": "2021-01-11T10:04:56.333Z",
"length": 1,
"lengthUnit": "WEEKS",
"activePeriod": {
"startTime": "02:00",
"endTime": "10:00"
},
"participants": {
"nodes": [
{
"id": "51",
"user": {
"id": "gid://gitlab/IncidentManagement::OncallParticipant/51",
"username": "oregand",
"avatarUrl": "/url",
"name": "david"
},
"colorWeight": "600",
"colorPalette": "orange"
}
]
}, },
"shifts": { {
"nodes": [ "id": "gid://gitlab/IncidentManagement::OncallRotation/5",
{ "name": "Rotation 247",
"participant": { "startsAt": "2021-01-06T10:04:56.333Z",
"id": "43", "endsAt": "2021-01-11T10:04:56.333Z",
"colorWeight": "600", "length": 1,
"colorPalette": "orange", "lengthUnit": "WEEKS",
"activePeriod": {
"startTime": "02:00",
"endTime": "10:00"
},
"participants": {
"nodes": [
{
"id": "51",
"user": { "user": {
"id": "gid://gitlab/User/43", "id": "gid://gitlab/IncidentManagement::OncallParticipant/51",
"avatarUrl": "url",
"username": "oregand", "username": "oregand",
"avatarUrl": "/url",
"name": "david" "name": "david"
} },
},
"startsAt": "2021-01-12T10:04:56.333Z",
"endsAt": "2021-01-15T10:04:56.333Z"
},
{
"participant": {
"id": "44",
"colorWeight": "600", "colorWeight": "600",
"colorPalette": "aqua", "colorPalette": "orange"
"user": { }
"id": "gid://gitlab/User/44", ]
"avatarUrl": "url", },
"username": "sarah.w", "shifts": {
"name": "sarah" "nodes": [
} {
"participant": {
"id": "43",
"colorWeight": "600",
"colorPalette": "orange",
"user": {
"id": "gid://gitlab/User/43",
"avatarUrl": "url",
"username": "oregand",
"name": "david"
}
},
"startsAt": "2021-01-12T10:04:56.333Z",
"endsAt": "2021-01-15T10:04:56.333Z"
}, },
"startsAt": "2021-01-16T10:04:56.333Z", {
"endsAt": "2021-01-30T10:04:56.333Z" "participant": {
} "id": "44",
] "colorWeight": "600",
"colorPalette": "aqua",
"user": {
"id": "gid://gitlab/User/44",
"avatarUrl": "url",
"username": "sarah.w",
"name": "sarah"
}
},
"startsAt": "2021-01-16T10:04:56.333Z",
"endsAt": "2021-01-30T10:04:56.333Z"
}
]
}
} }
}] ]
...@@ -96,9 +96,9 @@ describe('On-call schedule', () => { ...@@ -96,9 +96,9 @@ describe('On-call schedule', () => {
const findScheduleDescription = () => findSchedule().text(); const findScheduleDescription = () => findSchedule().text();
const findRotations = () => wrapper.findByTestId('rotationsBody'); const findRotations = () => wrapper.findByTestId('rotationsBody');
const findRotationsShiftPreset = () => wrapper.findByTestId('shift-preset-change'); const findRotationsShiftPreset = () => wrapper.findByTestId('shift-preset-change');
const findAddRotationsBtn = () => findRotationsHeader().find(GlButton); const findAddRotationsBtn = () => findRotationsHeader().findComponent(GlButton);
const findScheduleTimeline = () => findRotations().find(ScheduleTimelineSection); const findScheduleTimeline = () => findRotations().findComponent(ScheduleTimelineSection);
const findRotationsList = () => findRotations().find(RotationsListSection); const findRotationsList = () => findRotations().findComponent(RotationsListSection);
const findLoadPreviousTimeframeBtn = () => wrapper.findByTestId('previous-timeframe-btn'); const findLoadPreviousTimeframeBtn = () => wrapper.findByTestId('previous-timeframe-btn');
const findLoadNextTimeframeBtn = () => wrapper.findByTestId('next-timeframe-btn'); const findLoadNextTimeframeBtn = () => wrapper.findByTestId('next-timeframe-btn');
const findCollapsible = () => wrapper.findComponent(GlCollapse); const findCollapsible = () => wrapper.findComponent(GlCollapse);
......
...@@ -49,9 +49,9 @@ describe('AddEditRotationForm', () => { ...@@ -49,9 +49,9 @@ describe('AddEditRotationForm', () => {
const findRotationLength = () => wrapper.find('[id="rotation-length"]'); const findRotationLength = () => wrapper.find('[id="rotation-length"]');
const findRotationStartTime = () => wrapper.find('[data-testid="rotation-start-time"]'); const findRotationStartTime = () => wrapper.find('[data-testid="rotation-start-time"]');
const findRotationEndsContainer = () => wrapper.find('[data-testid="rotation-ends-on"]'); const findRotationEndsContainer = () => wrapper.find('[data-testid="rotation-ends-on"]');
const findEndDateToggle = () => wrapper.find(GlToggle); const findEndDateToggle = () => wrapper.findComponent(GlToggle);
const findRotationEndTime = () => wrapper.find('[data-testid="rotation-end-time"]'); const findRotationEndTime = () => wrapper.find('[data-testid="rotation-end-time"]');
const findUserSelector = () => wrapper.find(GlTokenSelector); const findUserSelector = () => wrapper.findComponent(GlTokenSelector);
const findRotationFormGroups = () => wrapper.findAllComponents(GlFormGroup); const findRotationFormGroups = () => wrapper.findAllComponents(GlFormGroup);
const findStartsOnTimeOptions = () => findRotationStartTime().findAllComponents(GlDropdownItem); const findStartsOnTimeOptions = () => findRotationStartTime().findAllComponents(GlDropdownItem);
const findEndsOnTimeOptions = () => findRotationEndTime().findAllComponents(GlDropdownItem); const findEndsOnTimeOptions = () => findRotationEndTime().findAllComponents(GlDropdownItem);
......
...@@ -77,7 +77,7 @@ describe('RotationsListSectionComponent', () => { ...@@ -77,7 +77,7 @@ describe('RotationsListSectionComponent', () => {
}); });
it('renders current day indicator in the first timeline cell', () => { it('renders current day indicator in the first timeline cell', () => {
expect(findTimelineCells().at(0).find(CurrentDayIndicator).exists()).toBe(true); expect(findTimelineCells().at(0).findComponent(CurrentDayIndicator).exists()).toBe(true);
}); });
it('render the correct amount of rotation assignees with their related information', () => { it('render the correct amount of rotation assignees with their related information', () => {
......
...@@ -35,7 +35,7 @@ describe('dashboard component', () => { ...@@ -35,7 +35,7 @@ describe('dashboard component', () => {
stubs, stubs,
}); });
const findEmptyState = () => wrapper.find(GlEmptyState); const findEmptyState = () => wrapper.findComponent(GlEmptyState);
const findAddProjectButton = () => wrapper.find('[data-testid=add-projects-button]'); const findAddProjectButton = () => wrapper.find('[data-testid=add-projects-button]');
beforeEach(() => { beforeEach(() => {
...@@ -84,7 +84,7 @@ describe('dashboard component', () => { ...@@ -84,7 +84,7 @@ describe('dashboard component', () => {
.then(waitForPromises) .then(waitForPromises)
.then(() => { .then(() => {
expect(store.state.projects.length).toEqual(2); expect(store.state.projects.length).toEqual(2);
expect(wrapper.findAll(Project).length).toEqual(2); expect(wrapper.findAllComponents(Project).length).toEqual(2);
}); });
}); });
}); });
...@@ -101,14 +101,14 @@ describe('dashboard component', () => { ...@@ -101,14 +101,14 @@ describe('dashboard component', () => {
}); });
it('includes a dashboard project component for each project', () => { it('includes a dashboard project component for each project', () => {
const projectComponents = wrapper.findAll(Project); const projectComponents = wrapper.findAllComponents(Project);
expect(projectComponents).toHaveLength(projectCount); expect(projectComponents).toHaveLength(projectCount);
}); });
it('passes each project to the dashboard project component', () => { it('passes each project to the dashboard project component', () => {
const [oneProject] = store.state.projects; const [oneProject] = store.state.projects;
const projectComponent = wrapper.find(Project); const projectComponent = wrapper.findComponent(Project);
expect(projectComponent.props().project).toEqual(oneProject); expect(projectComponent.props().project).toEqual(oneProject);
}); });
...@@ -132,7 +132,7 @@ describe('dashboard component', () => { ...@@ -132,7 +132,7 @@ describe('dashboard component', () => {
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(store.state.projects.length).toEqual(0); expect(store.state.projects.length).toEqual(0);
expect(wrapper.findAll(Project).length).toEqual(0); expect(wrapper.findAllComponents(Project).length).toEqual(0);
}); });
}); });
}); });
......
...@@ -60,11 +60,11 @@ describe('project header component', () => { ...@@ -60,11 +60,11 @@ describe('project header component', () => {
describe('wrapped components', () => { describe('wrapped components', () => {
describe('project avatar', () => { describe('project avatar', () => {
it('renders', () => { it('renders', () => {
expect(wrapper.findAll(ProjectAvatar)).toHaveLength(1); expect(wrapper.findAllComponents(ProjectAvatar)).toHaveLength(1);
}); });
it('binds project', () => { it('binds project', () => {
expect(wrapper.find(ProjectAvatar).props('project')).toEqual(mockOneProject); expect(wrapper.findComponent(ProjectAvatar).props('project')).toEqual(mockOneProject);
}); });
}); });
}); });
......
...@@ -49,7 +49,7 @@ describe('project component', () => { ...@@ -49,7 +49,7 @@ describe('project component', () => {
}); });
it('shows project title', () => { it('shows project title', () => {
const header = wrapper.find(ProjectHeader); const header = wrapper.findComponent(ProjectHeader);
expect(header.props('project')).toEqual(project); expect(header.props('project')).toEqual(project);
}); });
...@@ -60,7 +60,9 @@ describe('project component', () => { ...@@ -60,7 +60,9 @@ describe('project component', () => {
it('shows upgrade license text', () => { it('shows upgrade license text', () => {
expect(findDashboardCard().text()).toContain('upgrade its group plan to Premium'); expect(findDashboardCard().text()).toContain('upgrade its group plan to Premium');
expect(findDashboardCard().find(GlLink).attributes('href')).toBe(project.upgrade_path); expect(findDashboardCard().findComponent(GlLink).attributes('href')).toBe(
project.upgrade_path,
);
}); });
it('hides commit info', () => { it('hides commit info', () => {
...@@ -95,7 +97,7 @@ describe('project component', () => { ...@@ -95,7 +97,7 @@ describe('project component', () => {
describe('project header', () => { describe('project header', () => {
it('binds project', () => { it('binds project', () => {
const header = wrapper.find(ProjectHeader); const header = wrapper.findComponent(ProjectHeader);
expect(header.props('project')).toEqual(mockOneProject); expect(header.props('project')).toEqual(mockOneProject);
}); });
...@@ -103,7 +105,7 @@ describe('project component', () => { ...@@ -103,7 +105,7 @@ describe('project component', () => {
describe('alerts', () => { describe('alerts', () => {
it('binds alert count to count', () => { it('binds alert count to count', () => {
const alert = wrapper.find(Alerts); const alert = wrapper.findComponent(Alerts);
expect(alert.props('count')).toBe(mockOneProject.alert_count); expect(alert.props('count')).toBe(mockOneProject.alert_count);
}); });
...@@ -113,7 +115,7 @@ describe('project component', () => { ...@@ -113,7 +115,7 @@ describe('project component', () => {
let commit; let commit;
beforeEach(() => { beforeEach(() => {
commit = wrapper.find(Commit); commit = wrapper.findComponent(Commit);
}); });
it('binds commitRef', () => { it('binds commitRef', () => {
......
...@@ -32,7 +32,7 @@ describe('Reset pipeline minutes button', () => { ...@@ -32,7 +32,7 @@ describe('Reset pipeline minutes button', () => {
wrapper = null; wrapper = null;
}); });
const findResetButton = () => wrapper.find(GlButton); const findResetButton = () => wrapper.findComponent(GlButton);
it('should contain a button with the "Reset pipeline minutes" text', () => { it('should contain a button with the "Reset pipeline minutes" text', () => {
const button = findResetButton(); const button = findResetButton();
......
...@@ -61,7 +61,7 @@ describe('Verification page', () => { ...@@ -61,7 +61,7 @@ describe('Verification page', () => {
.spyOn(wrapper.find('iframe').element.contentWindow, 'postMessage') .spyOn(wrapper.find('iframe').element.contentWindow, 'postMessage')
.mockImplementation(dispatchWindowMessageEvent); .mockImplementation(dispatchWindowMessageEvent);
wrapper.find(GlButton).vm.$emit('click'); wrapper.findComponent(GlButton).vm.$emit('click');
}); });
it('triggers postMessage on the Zuora iframe', () => { it('triggers postMessage on the Zuora iframe', () => {
......
...@@ -47,7 +47,7 @@ describe('SAML providers members app', () => { ...@@ -47,7 +47,7 @@ describe('SAML providers members app', () => {
}); });
it('renders loader', () => { it('renders loader', () => {
expect(wrapper.find(GlSkeletonLoading).exists()).toBe(true); expect(wrapper.findComponent(GlSkeletonLoading).exists()).toBe(true);
}); });
}); });
...@@ -59,15 +59,15 @@ describe('SAML providers members app', () => { ...@@ -59,15 +59,15 @@ describe('SAML providers members app', () => {
}); });
it('does not render loader', () => { it('does not render loader', () => {
expect(wrapper.find(GlSkeletonLoading).exists()).toBe(false); expect(wrapper.findComponent(GlSkeletonLoading).exists()).toBe(false);
}); });
it('renders table', () => { it('renders table', () => {
expect(wrapper.find(GlTable).exists()).toBe(true); expect(wrapper.findComponent(GlTable).exists()).toBe(true);
}); });
it('requests next page when pagination component performs change', () => { it('requests next page when pagination component performs change', () => {
const changeFn = wrapper.find(TablePagination).props('change'); const changeFn = wrapper.findComponent(TablePagination).props('change');
changeFn(2); changeFn(2);
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(fetchPageMock).toHaveBeenCalledWith(expect.anything(), 2); expect(fetchPageMock).toHaveBeenCalledWith(expect.anything(), 2);
......
...@@ -82,6 +82,6 @@ describe('PendingMembersApp', () => { ...@@ -82,6 +82,6 @@ describe('PendingMembersApp', () => {
initialGetters: { tableItems: () => [mockInvitedApprovedMember] }, initialGetters: { tableItems: () => [mockInvitedApprovedMember] },
initialState: { members: [mockInvitedApprovedMember] }, initialState: { members: [mockInvitedApprovedMember] },
}); });
expect(wrapper.find(GlBadge).text()).toEqual('Awaiting member signup'); expect(wrapper.findComponent(GlBadge).text()).toEqual('Awaiting member signup');
}); });
}); });
...@@ -8,7 +8,7 @@ jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId'); ...@@ -8,7 +8,7 @@ jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
describe('Project remove modal', () => { describe('Project remove modal', () => {
let wrapper; let wrapper;
const findSharedDeleteButton = () => wrapper.find(SharedDeleteButton); const findSharedDeleteButton = () => wrapper.findComponent(SharedDeleteButton);
const defaultProps = { const defaultProps = {
adjournedRemovalDate: '2020-12-12', adjournedRemovalDate: '2020-12-12',
......
...@@ -5,7 +5,7 @@ import RelatedIssuableInput from '~/related_issues/components/related_issuable_i ...@@ -5,7 +5,7 @@ import RelatedIssuableInput from '~/related_issues/components/related_issuable_i
describe('blocking mr input root', () => { describe('blocking mr input root', () => {
let wrapper; let wrapper;
const getInput = () => wrapper.find(RelatedIssuableInput); const getInput = () => wrapper.findComponent(RelatedIssuableInput);
const addTokenizedInput = (input) => { const addTokenizedInput = (input) => {
getInput().vm.$emit('addIssuableFormInput', { getInput().vm.$emit('addIssuableFormInput', {
untouchedRawReferences: [input], untouchedRawReferences: [input],
......
...@@ -26,7 +26,7 @@ describe('projects/settings/components/shared_runners', () => { ...@@ -26,7 +26,7 @@ describe('projects/settings/components/shared_runners', () => {
}); });
}; };
const findSharedRunnersToggle = () => wrapper.find(GlToggle); const findSharedRunnersToggle = () => wrapper.findComponent(GlToggle);
const findCcValidationRequiredAlert = () => wrapper.findComponent(CcValidationRequiredAlert); const findCcValidationRequiredAlert = () => wrapper.findComponent(CcValidationRequiredAlert);
const getToggleValue = () => findSharedRunnersToggle().props('value'); const getToggleValue = () => findSharedRunnersToggle().props('value');
const isToggleDisabled = () => findSharedRunnersToggle().props('disabled'); const isToggleDisabled = () => findSharedRunnersToggle().props('disabled');
......
...@@ -25,11 +25,11 @@ describe('CreditCardVerification', () => { ...@@ -25,11 +25,11 @@ describe('CreditCardVerification', () => {
}; };
const verifyToggleEnabled = () => const verifyToggleEnabled = () =>
wrapper.find({ ref: 'verifyToggle' }).attributes('enabled') === 'true'; wrapper.findComponent({ ref: 'verifyToggle' }).attributes('enabled') === 'true';
const createToggleEnabled = () => const createToggleEnabled = () =>
wrapper.find({ ref: 'createToggle' }).attributes('enabled') === 'true'; wrapper.findComponent({ ref: 'createToggle' }).attributes('enabled') === 'true';
const findZuora = () => wrapper.find({ ref: 'zuora' }); const findZuora = () => wrapper.findComponent({ ref: 'zuora' });
const findSubmitButton = () => wrapper.find({ ref: 'submitButton' }); const findSubmitButton = () => wrapper.findComponent({ ref: 'submitButton' });
const toggleContainerHidden = () => const toggleContainerHidden = () =>
document.querySelector('.js-toggle-container').classList.contains('gl-display-none'); document.querySelector('.js-toggle-container').classList.contains('gl-display-none');
......
...@@ -34,12 +34,12 @@ describe('Verification', () => { ...@@ -34,12 +34,12 @@ describe('Verification', () => {
}); });
}; };
const findSubmitButton = () => wrapper.find({ ref: 'submitButton' }); const findSubmitButton = () => wrapper.findComponent({ ref: 'submitButton' });
const findZuora = () => wrapper.find({ ref: 'zuora' }); const findZuora = () => wrapper.findComponent({ ref: 'zuora' });
const findSkipLink = () => wrapper.find({ ref: 'skipLink' }); const findSkipLink = () => wrapper.findComponent({ ref: 'skipLink' });
const findPopover = () => wrapper.find({ ref: 'popover' }); const findPopover = () => wrapper.findComponent({ ref: 'popover' });
const findPopoverClose = () => wrapper.find({ ref: 'popoverClose' }); const findPopoverClose = () => wrapper.findComponent({ ref: 'popoverClose' });
const findSkipConfirmationLink = () => wrapper.find({ ref: 'skipConfirmationLink' }); const findSkipConfirmationLink = () => wrapper.findComponent({ ref: 'skipConfirmationLink' });
const expectRedirect = () => expect(redirectTo).toHaveBeenCalledWith(NEXT_STEP_URL); const expectRedirect = () => expect(redirectTo).toHaveBeenCalledWith(NEXT_STEP_URL);
const expectTrackingOfEvent = (event) => { const expectTrackingOfEvent = (event) => {
......
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