Commit 9d868dbb authored by Illya Klymov's avatar Illya Klymov

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

* migrate to proper use of findComponent/findAllComponents
parent 68755b38
...@@ -17,7 +17,7 @@ describe('Account verification modal', () => { ...@@ -17,7 +17,7 @@ describe('Account verification modal', () => {
}); });
}; };
const findModal = () => wrapper.find({ ref: 'modal' }); const findModal = () => wrapper.findComponent({ ref: 'modal' });
const zuoraSubmitSpy = jest.fn(); const zuoraSubmitSpy = jest.fn();
......
...@@ -22,7 +22,7 @@ describe('Qrtly Reconciliation Alert', () => { ...@@ -22,7 +22,7 @@ describe('Qrtly Reconciliation Alert', () => {
}); });
}; };
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -64,7 +64,7 @@ describe('subscription table row', () => { ...@@ -64,7 +64,7 @@ describe('subscription table row', () => {
const findHeaderCell = () => wrapper.find('[data-testid="header-cell"]'); const findHeaderCell = () => wrapper.find('[data-testid="header-cell"]');
const findContentCells = () => wrapper.findAll('[data-testid="content-cell"]'); const findContentCells = () => wrapper.findAll('[data-testid="content-cell"]');
const findHeaderIcon = () => findHeaderCell().find(GlIcon); const findHeaderIcon = () => findHeaderCell().findComponent(GlIcon);
const findColumnLabelAndTitle = (columnWrapper) => { const findColumnLabelAndTitle = (columnWrapper) => {
const label = columnWrapper.find('[data-testid="property-label"]'); const label = columnWrapper.find('[data-testid="property-label"]');
...@@ -121,7 +121,7 @@ describe('subscription table row', () => { ...@@ -121,7 +121,7 @@ describe('subscription table row', () => {
it('should render an info icon in "Column B"', () => { it('should render an info icon in "Column B"', () => {
const currentCol = findContentCells().at(1); const currentCol = findContentCells().at(1);
expect(currentCol.find(Popover).exists()).toBe(true); expect(currentCol.findComponent(Popover).exists()).toBe(true);
}); });
}); });
......
...@@ -69,7 +69,7 @@ describe('SubscriptionTable component', () => { ...@@ -69,7 +69,7 @@ describe('SubscriptionTable component', () => {
}); });
it('shows loading icon', () => { it('shows loading icon', () => {
expect(wrapper.find(GlLoadingIcon).isVisible()).toBeTruthy(); expect(wrapper.findComponent(GlLoadingIcon).isVisible()).toBeTruthy();
}); });
it('dispatches the correct actions', () => { it('dispatches the correct actions', () => {
...@@ -90,7 +90,7 @@ describe('SubscriptionTable component', () => { ...@@ -90,7 +90,7 @@ describe('SubscriptionTable component', () => {
}); });
it('should render a "Usage" and a "Billing" row', () => { it('should render a "Usage" and a "Billing" row', () => {
expect(wrapper.findAll(SubscriptionTableRow)).toHaveLength(2); expect(wrapper.findAllComponents(SubscriptionTableRow)).toHaveLength(2);
}); });
}); });
......
...@@ -31,12 +31,12 @@ describe('VerificationReminder', () => { ...@@ -31,12 +31,12 @@ describe('VerificationReminder', () => {
}); });
}; };
const findVerificationModal = () => wrapper.find({ ref: 'modal' }); const findVerificationModal = () => wrapper.findComponent({ ref: 'modal' });
const calloutDismisser = () => wrapper.find({ ref: 'calloutDismisser' }); const calloutDismisser = () => wrapper.findComponent({ ref: 'calloutDismisser' });
const findWarningAlert = () => wrapper.find({ ref: 'warningAlert' }); const findWarningAlert = () => wrapper.findComponent({ ref: 'warningAlert' });
const findSuccessAlert = () => wrapper.find({ ref: 'successAlert' }); const findSuccessAlert = () => wrapper.findComponent({ ref: 'successAlert' });
const findValidateLink = () => wrapper.find({ ref: 'validateLink' }); const findValidateLink = () => wrapper.findComponent({ ref: 'validateLink' });
const findDocsLink = () => wrapper.find({ ref: 'docsLink' }); const findDocsLink = () => wrapper.findComponent({ ref: 'docsLink' });
beforeEach(() => { beforeEach(() => {
window.gon = { window.gon = {
......
...@@ -20,15 +20,17 @@ describe('burndown_chart', () => { ...@@ -20,15 +20,17 @@ describe('burndown_chart', () => {
let wrapper; let wrapper;
let mock; let mock;
const findFilterLabel = () => wrapper.find({ ref: 'filterLabel' }); const findFilterLabel = () => wrapper.findComponent({ ref: 'filterLabel' });
const findIssuesButton = () => wrapper.find({ ref: 'totalIssuesButton' }); const findIssuesButton = () => wrapper.findComponent({ ref: 'totalIssuesButton' });
const findWeightButton = () => wrapper.find({ ref: 'totalWeightButton' }); const findWeightButton = () => wrapper.findComponent({ ref: 'totalWeightButton' });
const findActiveButtons = () => const findActiveButtons = () =>
wrapper.findAll(GlButton).filter((button) => button.attributes().category === 'primary'); wrapper
const findBurndownChart = () => wrapper.find(BurndownChart); .findAllComponents(GlButton)
const findBurnupChart = () => wrapper.find(BurnupChart); .filter((button) => button.attributes().category === 'primary');
const findOldBurndownChartButton = () => wrapper.find({ ref: 'oldBurndown' }); const findBurndownChart = () => wrapper.findComponent(BurndownChart);
const findNewBurndownChartButton = () => wrapper.find({ ref: 'newBurndown' }); const findBurnupChart = () => wrapper.findComponent(BurnupChart);
const findOldBurndownChartButton = () => wrapper.findComponent({ ref: 'oldBurndown' });
const findNewBurndownChartButton = () => wrapper.findComponent({ ref: 'newBurndown' });
const defaultProps = { const defaultProps = {
fullPath: 'gitlab-org/subgroup', fullPath: 'gitlab-org/subgroup',
...@@ -146,7 +148,7 @@ describe('burndown_chart', () => { ...@@ -146,7 +148,7 @@ describe('burndown_chart', () => {
}, },
}); });
expect(wrapper.find(OpenTimeboxSummary).props()).toEqual({ expect(wrapper.findComponent(OpenTimeboxSummary).props()).toEqual({
iterationId: 'gid://gitlab/Iteration/11', iterationId: 'gid://gitlab/Iteration/11',
displayValue: 'count', displayValue: 'count',
namespaceType: 'group', namespaceType: 'group',
...@@ -167,7 +169,7 @@ describe('burndown_chart', () => { ...@@ -167,7 +169,7 @@ describe('burndown_chart', () => {
}, },
}); });
expect(wrapper.find(TimeboxSummaryCards).exists()).toBe(true); expect(wrapper.findComponent(TimeboxSummaryCards).exists()).toBe(true);
}); });
it('uses burndown data computed from burnup data', () => { it('uses burndown data computed from burnup data', () => {
......
...@@ -12,7 +12,7 @@ describe('burndown_chart', () => { ...@@ -12,7 +12,7 @@ describe('burndown_chart', () => {
openIssuesWeight: [], openIssuesWeight: [],
}; };
const findChart = () => wrapper.find(GlLineChart); const findChart = () => wrapper.findComponent(GlLineChart);
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = shallowMount(BurndownChart, { wrapper = shallowMount(BurndownChart, {
......
...@@ -11,7 +11,7 @@ describe('Burnup chart', () => { ...@@ -11,7 +11,7 @@ describe('Burnup chart', () => {
dueDate: '2019-09-09T00:00:00.000Z', dueDate: '2019-09-09T00:00:00.000Z',
}; };
const findChart = () => wrapper.find(GlLineChart); const findChart = () => wrapper.findComponent(GlLineChart);
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
wrapper = shallowMount(BurnupChart, { wrapper = shallowMount(BurnupChart, {
......
...@@ -34,9 +34,9 @@ describe('Iterations report summary cards', () => { ...@@ -34,9 +34,9 @@ describe('Iterations report summary cards', () => {
wrapper = null; wrapper = null;
}); });
const findCompleteCard = () => wrapper.findAll(GlCard).at(0).text(); const findCompleteCard = () => wrapper.findAllComponents(GlCard).at(0).text();
const findIncompleteCard = () => wrapper.findAll(GlCard).at(1).text(); const findIncompleteCard = () => wrapper.findAllComponents(GlCard).at(1).text();
const findUnstartedCard = () => wrapper.findAll(GlCard).at(2).text(); const findUnstartedCard = () => wrapper.findAllComponents(GlCard).at(2).text();
describe('with valid totals', () => { describe('with valid totals', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -26,7 +26,7 @@ describe('Environments', () => { ...@@ -26,7 +26,7 @@ describe('Environments', () => {
}); });
it('renders an empty state if no deployments are found', () => { it('renders an empty state if no deployments are found', () => {
const emptyState = wrapper.find(GlEmptyState); const emptyState = wrapper.findComponent(GlEmptyState);
const emptyStateText = emptyState.text().replace(/\s+/g, ' '); const emptyStateText = emptyState.text().replace(/\s+/g, ' ');
expect(emptyState.exists()).toBe(true); expect(emptyState.exists()).toBe(true);
...@@ -45,7 +45,7 @@ describe('Environments', () => { ...@@ -45,7 +45,7 @@ describe('Environments', () => {
stubs: { deploymentInstance: { template: '<div class="js-deployment-instance"></div>' } }, stubs: { deploymentInstance: { template: '<div class="js-deployment-instance"></div>' } },
}); });
table = wrapper.find(GlTable); table = wrapper.findComponent(GlTable);
}); });
it('renders a table component', () => { it('renders a table component', () => {
...@@ -77,7 +77,7 @@ describe('Environments', () => { ...@@ -77,7 +77,7 @@ describe('Environments', () => {
const { status } = environment.rolloutStatus; const { status } = environment.rolloutStatus;
if (status === 'loading') { if (status === 'loading') {
const loader = tableRows.at(i).find(GlLoadingIcon); const loader = tableRows.at(i).findComponent(GlLoadingIcon);
expect(loader.exists()).toBe(true); expect(loader.exists()).toBe(true);
} }
...@@ -101,7 +101,7 @@ describe('Environments', () => { ...@@ -101,7 +101,7 @@ describe('Environments', () => {
if (status !== 'loading' && instances.length === 0) { if (status !== 'loading' && instances.length === 0) {
const emptyState = tableRows.at(i).find('.deployments-empty'); const emptyState = tableRows.at(i).find('.deployments-empty');
const emptyStateIcon = emptyState.find(GlIcon); const emptyStateIcon = emptyState.findComponent(GlIcon);
expect(emptyState.exists()).toBe(true); expect(emptyState.exists()).toBe(true);
expect(emptyStateIcon.exists()).toBe(true); expect(emptyStateIcon.exists()).toBe(true);
......
...@@ -33,7 +33,7 @@ describe('Codequality report app', () => { ...@@ -33,7 +33,7 @@ describe('Codequality report app', () => {
const findStatus = () => wrapper.find('.js-code-text'); const findStatus = () => wrapper.find('.js-code-text');
const findSuccessIcon = () => wrapper.find('.js-ci-status-icon-success'); const findSuccessIcon = () => wrapper.find('.js-ci-status-icon-success');
const findWarningIcon = () => wrapper.find('.js-ci-status-icon-warning'); const findWarningIcon = () => wrapper.find('.js-ci-status-icon-warning');
const findInfiniteScroll = () => wrapper.find(GlInfiniteScroll); const findInfiniteScroll = () => wrapper.findComponent(GlInfiniteScroll);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
......
...@@ -78,7 +78,7 @@ describe('EE CodeQualityGutterIcon', () => { ...@@ -78,7 +78,7 @@ describe('EE CodeQualityGutterIcon', () => {
wrapper.findComponent(GlIcon).trigger('mouseover'); wrapper.findComponent(GlIcon).trigger('mouseover');
expect(wrapper.find(GlPopover).props().target).toBe(popoverTarget); expect(wrapper.findComponent(GlPopover).props().target).toBe(popoverTarget);
}); });
it('passes the issue data into the issue components correctly', () => { it('passes the issue data into the issue components correctly', () => {
......
...@@ -80,7 +80,7 @@ describe('EE DiffLineNoteForm', () => { ...@@ -80,7 +80,7 @@ describe('EE DiffLineNoteForm', () => {
}); });
const submitNoteAddToReview = () => const submitNoteAddToReview = () =>
wrapper.find(NoteForm).vm.$emit('handleFormUpdateAddToReview', note); wrapper.findComponent(NoteForm).vm.$emit('handleFormUpdateAddToReview', note);
const saveDraftCommitId = () => saveDraft.mock.calls[0][1].data.note.commit_id; const saveDraftCommitId = () => saveDraft.mock.calls[0][1].data.note.commit_id;
describe('when user submits note to review', () => { describe('when user submits note to review', () => {
......
...@@ -20,7 +20,7 @@ describe('Environment Alert', () => { ...@@ -20,7 +20,7 @@ describe('Environment Alert', () => {
}); });
}; };
const findSeverityBadge = () => wrapper.find(SeverityBadge); const findSeverityBadge = () => wrapper.findComponent(SeverityBadge);
beforeEach(() => { beforeEach(() => {
factory(); factory();
......
...@@ -72,7 +72,7 @@ describe('Environment', () => { ...@@ -72,7 +72,7 @@ describe('Environment', () => {
}); });
it('should render deploy boards', () => { it('should render deploy boards', () => {
expect(wrapper.find(DeployBoard).exists()).toBe(true); expect(wrapper.findComponent(DeployBoard).exists()).toBe(true);
}); });
it('should render arrow to open deploy boards', () => { it('should render arrow to open deploy boards', () => {
......
...@@ -44,6 +44,6 @@ describe('Environment table', () => { ...@@ -44,6 +44,6 @@ describe('Environment table', () => {
shallowMount, shallowMount,
); );
expect(wrapper.find(EnvironmentAlert).exists()).toBe(true); expect(wrapper.findComponent(EnvironmentAlert).exists()).toBe(true);
}); });
}); });
...@@ -61,7 +61,7 @@ describe('dashboard', () => { ...@@ -61,7 +61,7 @@ describe('dashboard', () => {
store.replaceState(state()); store.replaceState(state());
}); });
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.findComponent(GlPagination);
it('should match the snapshot', () => { it('should match the snapshot', () => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
...@@ -72,7 +72,7 @@ describe('dashboard', () => { ...@@ -72,7 +72,7 @@ describe('dashboard', () => {
}); });
it('should render the empty state component', () => { it('should render the empty state component', () => {
expect(wrapper.find(GlEmptyState).exists()).toBe(true); expect(wrapper.findComponent(GlEmptyState).exists()).toBe(true);
}); });
it('should not render pagination in empty state', () => { it('should not render pagination in empty state', () => {
...@@ -93,7 +93,7 @@ describe('dashboard', () => { ...@@ -93,7 +93,7 @@ describe('dashboard', () => {
}); });
it('includes the correct documentation link in the message', () => { it('includes the correct documentation link in the message', () => {
const helpLink = message.find(GlLink); const helpLink = message.findComponent(GlLink);
expect(helpLink.text()).toBe('More information'); expect(helpLink.text()).toBe('More information');
expect(helpLink.attributes('href')).toBe(propsData.environmentsDashboardHelpPath); expect(helpLink.attributes('href')).toBe(propsData.environmentsDashboardHelpPath);
...@@ -105,7 +105,7 @@ describe('dashboard', () => { ...@@ -105,7 +105,7 @@ describe('dashboard', () => {
let button; let button;
beforeEach(() => { beforeEach(() => {
button = wrapper.find(GlButton); button = wrapper.findComponent(GlButton);
}); });
it('is labelled correctly', () => { it('is labelled correctly', () => {
...@@ -128,12 +128,12 @@ describe('dashboard', () => { ...@@ -128,12 +128,12 @@ describe('dashboard', () => {
describe('project header', () => { describe('project header', () => {
it('should have one project header per project', () => { it('should have one project header per project', () => {
const headers = wrapper.findAll(ProjectHeader); const headers = wrapper.findAllComponents(ProjectHeader);
expect(headers).toHaveLength(2); expect(headers).toHaveLength(2);
}); });
it('should remove a project if it emits `remove`', () => { it('should remove a project if it emits `remove`', () => {
const header = wrapper.find(ProjectHeader); const header = wrapper.findComponent(ProjectHeader);
header.vm.$emit('remove'); header.vm.$emit('remove');
expect(actionSpies.removeProject).toHaveBeenCalled(); expect(actionSpies.removeProject).toHaveBeenCalled();
}); });
...@@ -141,39 +141,39 @@ describe('dashboard', () => { ...@@ -141,39 +141,39 @@ describe('dashboard', () => {
describe('environment component', () => { describe('environment component', () => {
it('should have one environment component per environment', () => { it('should have one environment component per environment', () => {
const environments = wrapper.findAll(Environment); const environments = wrapper.findAllComponents(Environment);
expect(environments).toHaveLength(3); expect(environments).toHaveLength(3);
}); });
}); });
describe('project selector modal', () => { describe('project selector modal', () => {
beforeEach(() => { beforeEach(() => {
wrapper.find(GlButton).trigger('click'); wrapper.findComponent(GlButton).trigger('click');
return nextTick(); return nextTick();
}); });
it('should fire the add projects action on ok', () => { it('should fire the add projects action on ok', () => {
wrapper.find(GlModal).vm.$emit('ok'); wrapper.findComponent(GlModal).vm.$emit('ok');
expect(actionSpies.addProjectsToDashboard).toHaveBeenCalled(); expect(actionSpies.addProjectsToDashboard).toHaveBeenCalled();
}); });
it('should fire clear search when the modal is hidden', () => { it('should fire clear search when the modal is hidden', () => {
wrapper.find(GlModal).vm.$emit('hidden'); wrapper.findComponent(GlModal).vm.$emit('hidden');
expect(actionSpies.clearSearchResults).toHaveBeenCalled(); expect(actionSpies.clearSearchResults).toHaveBeenCalled();
}); });
it('should set the search query when searching', () => { it('should set the search query when searching', () => {
wrapper.find(ProjectSelector).vm.$emit('searched', 'test'); wrapper.findComponent(ProjectSelector).vm.$emit('searched', 'test');
expect(actionSpies.setSearchQuery).toHaveBeenCalledWith(expect.any(Object), 'test'); expect(actionSpies.setSearchQuery).toHaveBeenCalledWith(expect.any(Object), 'test');
}); });
it('should fetch query results when searching', () => { it('should fetch query results when searching', () => {
wrapper.find(ProjectSelector).vm.$emit('searched', 'test'); wrapper.findComponent(ProjectSelector).vm.$emit('searched', 'test');
expect(actionSpies.fetchSearchResults).toHaveBeenCalled(); expect(actionSpies.fetchSearchResults).toHaveBeenCalled();
}); });
it('should toggle a project when clicked', () => { it('should toggle a project when clicked', () => {
wrapper.find(ProjectSelector).vm.$emit('projectClicked', { name: 'test', id: 1 }); wrapper.findComponent(ProjectSelector).vm.$emit('projectClicked', { name: 'test', id: 1 });
expect(actionSpies.toggleSelectedProject).toHaveBeenCalledWith(expect.any(Object), { expect(actionSpies.toggleSelectedProject).toHaveBeenCalledWith(expect.any(Object), {
name: 'test', name: 'test',
id: 1, id: 1,
...@@ -181,7 +181,7 @@ describe('dashboard', () => { ...@@ -181,7 +181,7 @@ describe('dashboard', () => {
}); });
it('should fetch the next page when bottom is reached', () => { it('should fetch the next page when bottom is reached', () => {
wrapper.find(ProjectSelector).vm.$emit('bottomReached'); wrapper.findComponent(ProjectSelector).vm.$emit('bottomReached');
expect(actionSpies.fetchNextPage).toHaveBeenCalled(); expect(actionSpies.fetchNextPage).toHaveBeenCalled();
}); });
...@@ -189,7 +189,7 @@ describe('dashboard', () => { ...@@ -189,7 +189,7 @@ describe('dashboard', () => {
store.state.pageInfo = { totalResults: 100 }; store.state.pageInfo = { totalResults: 100 };
await nextTick(); await nextTick();
expect(wrapper.find(ProjectSelector).props('totalResults')).toBe(100); expect(wrapper.findComponent(ProjectSelector).props('totalResults')).toBe(100);
}); });
}); });
......
...@@ -33,15 +33,17 @@ describe('Environment Header', () => { ...@@ -33,15 +33,17 @@ describe('Environment Header', () => {
}); });
it('renders a link to the environment page', () => { it('renders a link to the environment page', () => {
expect(wrapper.find(GlLink).attributes('href')).toBe(propsData.environment.environment_path); expect(wrapper.findComponent(GlLink).attributes('href')).toBe(
propsData.environment.environment_path,
);
}); });
it('does not show a badge with the number of environments in the folder', () => { it('does not show a badge with the number of environments in the folder', () => {
expect(wrapper.find(GlBadge).exists()).toBe(false); expect(wrapper.findComponent(GlBadge).exists()).toBe(false);
}); });
it('renders a link to the external app', () => { it('renders a link to the external app', () => {
expect(wrapper.find(ReviewAppLink).attributes('href')).toBe( expect(wrapper.findComponent(ReviewAppLink).attributes('href')).toBe(
propsData.environment.external_url, propsData.environment.external_url,
); );
}); });
...@@ -64,12 +66,12 @@ describe('Environment Header', () => { ...@@ -64,12 +66,12 @@ describe('Environment Header', () => {
it('shows a badge with the number of other environments in the folder', () => { it('shows a badge with the number of other environments in the folder', () => {
const expected = propsData.environment.size.toString(); const expected = propsData.environment.size.toString();
expect(wrapper.find(GlBadge).text()).toBe(expected); expect(wrapper.findComponent(GlBadge).text()).toBe(expected);
}); });
it('shows an icon stating the environment is one of many in a folder', () => { it('shows an icon stating the environment is one of many in a folder', () => {
expect(wrapper.find(GlIcon).attributes('name')).toBe('information'); expect(wrapper.findComponent(GlIcon).attributes('name')).toBe('information');
expect(wrapper.find(GlIcon).attributes('title')).toMatch(/last updated environment/); expect(wrapper.findComponent(GlIcon).attributes('title')).toMatch(/last updated environment/);
}); });
it('matches the snapshot', () => { it('matches the snapshot', () => {
......
...@@ -29,14 +29,14 @@ describe('Environment', () => { ...@@ -29,14 +29,14 @@ describe('Environment', () => {
describe('wrapped components', () => { describe('wrapped components', () => {
describe('environment header', () => { describe('environment header', () => {
it('binds environment', () => { it('binds environment', () => {
expect(wrapper.find(EnvironmentHeader).props('environment')).toBe(environment); expect(wrapper.findComponent(EnvironmentHeader).props('environment')).toBe(environment);
}); });
}); });
describe('alerts', () => { describe('alerts', () => {
let alert; let alert;
beforeEach(() => { beforeEach(() => {
alert = wrapper.find(Alert); alert = wrapper.findComponent(Alert);
}); });
it('binds alert count to count', () => { it('binds alert count to count', () => {
expect(alert.props('count')).toBe(environment.alert_count); expect(alert.props('count')).toBe(environment.alert_count);
...@@ -49,7 +49,7 @@ describe('Environment', () => { ...@@ -49,7 +49,7 @@ describe('Environment', () => {
let commit; let commit;
beforeEach(() => { beforeEach(() => {
commit = wrapper.find(Commit); commit = wrapper.findComponent(Commit);
}); });
it('binds commitRef', () => { it('binds commitRef', () => {
......
...@@ -36,7 +36,7 @@ describe('Project Header', () => { ...@@ -36,7 +36,7 @@ describe('Project Header', () => {
describe('renders project namespace, name, and avatars', () => { describe('renders project namespace, name, and avatars', () => {
it('shows the project namespace avatar', () => { it('shows the project namespace avatar', () => {
const projectNamespaceAvatar = wrapper.findAll(ProjectAvatar).at(0); const projectNamespaceAvatar = wrapper.findAllComponents(ProjectAvatar).at(0);
expect(projectNamespaceAvatar.props('project')).toEqual(propsData.project.namespace); expect(projectNamespaceAvatar.props('project')).toEqual(propsData.project.namespace);
}); });
...@@ -50,7 +50,7 @@ describe('Project Header', () => { ...@@ -50,7 +50,7 @@ describe('Project Header', () => {
}); });
it('shows the project avatar', () => { it('shows the project avatar', () => {
const projectAvatar = wrapper.findAll(ProjectAvatar).at(1); const projectAvatar = wrapper.findAllComponents(ProjectAvatar).at(1);
expect(projectAvatar.props('project')).toEqual(propsData.project); expect(projectAvatar.props('project')).toEqual(propsData.project);
}); });
...@@ -66,16 +66,16 @@ describe('Project Header', () => { ...@@ -66,16 +66,16 @@ describe('Project Header', () => {
describe('more actions', () => { describe('more actions', () => {
it('should list "remove" as an action', () => { it('should list "remove" as an action', () => {
const removeLink = wrapper const removeLink = wrapper
.find(GlDropdown) .findComponent(GlDropdown)
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.filter((w) => w.text() === 'Remove'); .filter((w) => w.text() === 'Remove');
expect(removeLink.exists()).toBe(true); expect(removeLink.exists()).toBe(true);
}); });
it('should emit a "remove" event when "remove" is clicked', () => { it('should emit a "remove" event when "remove" is clicked', () => {
const removeLink = wrapper const removeLink = wrapper
.find(GlDropdown) .findComponent(GlDropdown)
.findAll(GlDropdownItem) .findAllComponents(GlDropdownItem)
.filter((w) => w.text() === 'Remove'); .filter((w) => w.text() === 'Remove');
removeLink.at(0).vm.$emit('click'); removeLink.at(0).vm.$emit('click');
......
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