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', () => {
wrapper.destroy();
});
const findTimezoneDropdown = () => wrapper.find(GlDropdown);
const findTimezoneDropdown = () => wrapper.findComponent(GlDropdown);
const findDropdownOptions = () => wrapper.findAllComponents(GlDropdownItem);
const findTimezoneSearchBox = () => wrapper.find(GlSearchBoxByType);
const findScheduleName = () => wrapper.find(GlFormGroup);
const findTimezoneSearchBox = () => wrapper.findComponent(GlSearchBoxByType);
const findScheduleName = () => wrapper.findComponent(GlFormGroup);
it('renders form layout', () => {
createComponent({
......
[{
[
{
"id": "gid://gitlab/IncidentManagement::OncallRotation/2",
"name": "Rotation 242",
"startsAt": "2021-01-13T11:04:56.333Z",
......@@ -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": [
{
"participant": {
"id": "43",
"colorWeight": "600",
"colorPalette": "orange",
{
"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/User/43",
"avatarUrl": "url",
"id": "gid://gitlab/IncidentManagement::OncallParticipant/51",
"username": "oregand",
"avatarUrl": "/url",
"name": "david"
}
},
"startsAt": "2021-01-12T10:04:56.333Z",
"endsAt": "2021-01-15T10:04:56.333Z"
},
{
"participant": {
"id": "44",
},
"colorWeight": "600",
"colorPalette": "aqua",
"user": {
"id": "gid://gitlab/User/44",
"avatarUrl": "url",
"username": "sarah.w",
"name": "sarah"
}
"colorPalette": "orange"
}
]
},
"shifts": {
"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', () => {
const findScheduleDescription = () => findSchedule().text();
const findRotations = () => wrapper.findByTestId('rotationsBody');
const findRotationsShiftPreset = () => wrapper.findByTestId('shift-preset-change');
const findAddRotationsBtn = () => findRotationsHeader().find(GlButton);
const findScheduleTimeline = () => findRotations().find(ScheduleTimelineSection);
const findRotationsList = () => findRotations().find(RotationsListSection);
const findAddRotationsBtn = () => findRotationsHeader().findComponent(GlButton);
const findScheduleTimeline = () => findRotations().findComponent(ScheduleTimelineSection);
const findRotationsList = () => findRotations().findComponent(RotationsListSection);
const findLoadPreviousTimeframeBtn = () => wrapper.findByTestId('previous-timeframe-btn');
const findLoadNextTimeframeBtn = () => wrapper.findByTestId('next-timeframe-btn');
const findCollapsible = () => wrapper.findComponent(GlCollapse);
......
......@@ -49,9 +49,9 @@ describe('AddEditRotationForm', () => {
const findRotationLength = () => wrapper.find('[id="rotation-length"]');
const findRotationStartTime = () => wrapper.find('[data-testid="rotation-start-time"]');
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 findUserSelector = () => wrapper.find(GlTokenSelector);
const findUserSelector = () => wrapper.findComponent(GlTokenSelector);
const findRotationFormGroups = () => wrapper.findAllComponents(GlFormGroup);
const findStartsOnTimeOptions = () => findRotationStartTime().findAllComponents(GlDropdownItem);
const findEndsOnTimeOptions = () => findRotationEndTime().findAllComponents(GlDropdownItem);
......
......@@ -77,7 +77,7 @@ describe('RotationsListSectionComponent', () => {
});
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', () => {
......
......@@ -35,7 +35,7 @@ describe('dashboard component', () => {
stubs,
});
const findEmptyState = () => wrapper.find(GlEmptyState);
const findEmptyState = () => wrapper.findComponent(GlEmptyState);
const findAddProjectButton = () => wrapper.find('[data-testid=add-projects-button]');
beforeEach(() => {
......@@ -84,7 +84,7 @@ describe('dashboard component', () => {
.then(waitForPromises)
.then(() => {
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', () => {
});
it('includes a dashboard project component for each project', () => {
const projectComponents = wrapper.findAll(Project);
const projectComponents = wrapper.findAllComponents(Project);
expect(projectComponents).toHaveLength(projectCount);
});
it('passes each project to the dashboard project component', () => {
const [oneProject] = store.state.projects;
const projectComponent = wrapper.find(Project);
const projectComponent = wrapper.findComponent(Project);
expect(projectComponent.props().project).toEqual(oneProject);
});
......@@ -132,7 +132,7 @@ describe('dashboard component', () => {
return waitForPromises().then(() => {
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', () => {
describe('wrapped components', () => {
describe('project avatar', () => {
it('renders', () => {
expect(wrapper.findAll(ProjectAvatar)).toHaveLength(1);
expect(wrapper.findAllComponents(ProjectAvatar)).toHaveLength(1);
});
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', () => {
});
it('shows project title', () => {
const header = wrapper.find(ProjectHeader);
const header = wrapper.findComponent(ProjectHeader);
expect(header.props('project')).toEqual(project);
});
......@@ -60,7 +60,9 @@ describe('project component', () => {
it('shows upgrade license text', () => {
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', () => {
......@@ -95,7 +97,7 @@ describe('project component', () => {
describe('project header', () => {
it('binds project', () => {
const header = wrapper.find(ProjectHeader);
const header = wrapper.findComponent(ProjectHeader);
expect(header.props('project')).toEqual(mockOneProject);
});
......@@ -103,7 +105,7 @@ describe('project component', () => {
describe('alerts', () => {
it('binds alert count to count', () => {
const alert = wrapper.find(Alerts);
const alert = wrapper.findComponent(Alerts);
expect(alert.props('count')).toBe(mockOneProject.alert_count);
});
......@@ -113,7 +115,7 @@ describe('project component', () => {
let commit;
beforeEach(() => {
commit = wrapper.find(Commit);
commit = wrapper.findComponent(Commit);
});
it('binds commitRef', () => {
......
......@@ -32,7 +32,7 @@ describe('Reset pipeline minutes button', () => {
wrapper = null;
});
const findResetButton = () => wrapper.find(GlButton);
const findResetButton = () => wrapper.findComponent(GlButton);
it('should contain a button with the "Reset pipeline minutes" text', () => {
const button = findResetButton();
......
......@@ -61,7 +61,7 @@ describe('Verification page', () => {
.spyOn(wrapper.find('iframe').element.contentWindow, 'postMessage')
.mockImplementation(dispatchWindowMessageEvent);
wrapper.find(GlButton).vm.$emit('click');
wrapper.findComponent(GlButton).vm.$emit('click');
});
it('triggers postMessage on the Zuora iframe', () => {
......
......@@ -47,7 +47,7 @@ describe('SAML providers members app', () => {
});
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', () => {
});
it('does not render loader', () => {
expect(wrapper.find(GlSkeletonLoading).exists()).toBe(false);
expect(wrapper.findComponent(GlSkeletonLoading).exists()).toBe(false);
});
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', () => {
const changeFn = wrapper.find(TablePagination).props('change');
const changeFn = wrapper.findComponent(TablePagination).props('change');
changeFn(2);
return wrapper.vm.$nextTick(() => {
expect(fetchPageMock).toHaveBeenCalledWith(expect.anything(), 2);
......
......@@ -82,6 +82,6 @@ describe('PendingMembersApp', () => {
initialGetters: { tableItems: () => [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');
describe('Project remove modal', () => {
let wrapper;
const findSharedDeleteButton = () => wrapper.find(SharedDeleteButton);
const findSharedDeleteButton = () => wrapper.findComponent(SharedDeleteButton);
const defaultProps = {
adjournedRemovalDate: '2020-12-12',
......
......@@ -5,7 +5,7 @@ import RelatedIssuableInput from '~/related_issues/components/related_issuable_i
describe('blocking mr input root', () => {
let wrapper;
const getInput = () => wrapper.find(RelatedIssuableInput);
const getInput = () => wrapper.findComponent(RelatedIssuableInput);
const addTokenizedInput = (input) => {
getInput().vm.$emit('addIssuableFormInput', {
untouchedRawReferences: [input],
......
......@@ -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 getToggleValue = () => findSharedRunnersToggle().props('value');
const isToggleDisabled = () => findSharedRunnersToggle().props('disabled');
......
......@@ -25,11 +25,11 @@ describe('CreditCardVerification', () => {
};
const verifyToggleEnabled = () =>
wrapper.find({ ref: 'verifyToggle' }).attributes('enabled') === 'true';
wrapper.findComponent({ ref: 'verifyToggle' }).attributes('enabled') === 'true';
const createToggleEnabled = () =>
wrapper.find({ ref: 'createToggle' }).attributes('enabled') === 'true';
const findZuora = () => wrapper.find({ ref: 'zuora' });
const findSubmitButton = () => wrapper.find({ ref: 'submitButton' });
wrapper.findComponent({ ref: 'createToggle' }).attributes('enabled') === 'true';
const findZuora = () => wrapper.findComponent({ ref: 'zuora' });
const findSubmitButton = () => wrapper.findComponent({ ref: 'submitButton' });
const toggleContainerHidden = () =>
document.querySelector('.js-toggle-container').classList.contains('gl-display-none');
......
......@@ -34,12 +34,12 @@ describe('Verification', () => {
});
};
const findSubmitButton = () => wrapper.find({ ref: 'submitButton' });
const findZuora = () => wrapper.find({ ref: 'zuora' });
const findSkipLink = () => wrapper.find({ ref: 'skipLink' });
const findPopover = () => wrapper.find({ ref: 'popover' });
const findPopoverClose = () => wrapper.find({ ref: 'popoverClose' });
const findSkipConfirmationLink = () => wrapper.find({ ref: 'skipConfirmationLink' });
const findSubmitButton = () => wrapper.findComponent({ ref: 'submitButton' });
const findZuora = () => wrapper.findComponent({ ref: 'zuora' });
const findSkipLink = () => wrapper.findComponent({ ref: 'skipLink' });
const findPopover = () => wrapper.findComponent({ ref: 'popover' });
const findPopoverClose = () => wrapper.findComponent({ ref: 'popoverClose' });
const findSkipConfirmationLink = () => wrapper.findComponent({ ref: 'skipConfirmationLink' });
const expectRedirect = () => expect(redirectTo).toHaveBeenCalledWith(NEXT_STEP_URL);
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