Commit f45addfa authored by Illya Klymov's avatar Illya Klymov

Replace deprecated `contains` method

Replace `contains` with chaining `find` and `exists`
`contains` is deprecated in `@vue/test-utils` 1.x
parent 42e1a2aa
...@@ -29,8 +29,8 @@ describe('AncestorsTreeContainer', () => { ...@@ -29,8 +29,8 @@ describe('AncestorsTreeContainer', () => {
}); });
const findTooltip = () => wrapper.find('.collapse-truncated-title'); const findTooltip = () => wrapper.find('.collapse-truncated-title');
const containsTimeline = () => wrapper.contains('.vertical-timeline'); const containsTimeline = () => wrapper.find('.vertical-timeline').exists();
const containsValue = () => wrapper.contains('.value'); const containsValue = () => wrapper.find('.value').exists();
it('renders all ancestors rows', () => { it('renders all ancestors rows', () => {
createComponent(); createComponent();
...@@ -67,7 +67,7 @@ describe('AncestorsTreeContainer', () => { ...@@ -67,7 +67,7 @@ describe('AncestorsTreeContainer', () => {
isFetching: true, isFetching: true,
}); });
expect(wrapper.contains(GlLoadingIcon)).toBe(true); expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
}); });
it('escapes html in the tooltip', () => { it('escapes html in the tooltip', () => {
......
...@@ -24,16 +24,17 @@ describe('Weight', () => { ...@@ -24,16 +24,17 @@ describe('Weight', () => {
} }
}); });
const containsCollapsedLoadingIcon = () => wrapper.contains('.js-weight-collapsed-loading-icon'); const containsCollapsedLoadingIcon = () =>
const containsLoadingIcon = () => wrapper.contains('.js-weight-loading-icon'); wrapper.find('.js-weight-collapsed-loading-icon').exists();
const containsLoadingIcon = () => wrapper.find('.js-weight-loading-icon').exists();
const findCollapsedLabel = () => wrapper.find('.js-weight-collapsed-weight-label'); const findCollapsedLabel = () => wrapper.find('.js-weight-collapsed-weight-label');
const findLabelValue = () => wrapper.find('.js-weight-weight-label-value'); const findLabelValue = () => wrapper.find('.js-weight-weight-label-value');
const findLabelNoValue = () => wrapper.find('.js-weight-weight-label .no-value'); const findLabelNoValue = () => wrapper.find('.js-weight-weight-label .no-value');
const findCollapsedBlock = () => wrapper.find('.js-weight-collapsed-block'); const findCollapsedBlock = () => wrapper.find('.js-weight-collapsed-block');
const findEditLink = () => wrapper.find('.js-weight-edit-link'); const findEditLink = () => wrapper.find('.js-weight-edit-link');
const findRemoveLink = () => wrapper.find('.js-weight-remove-link'); const findRemoveLink = () => wrapper.find('.js-weight-remove-link');
const containsEditableField = () => wrapper.contains({ ref: 'editableField' }); const containsEditableField = () => wrapper.find({ ref: 'editableField' }).exists();
const containsInputError = () => wrapper.contains('.gl-field-error'); const containsInputError = () => wrapper.find('.gl-field-error').exists();
it('shows loading spinner when fetching', () => { it('shows loading spinner when fetching', () => {
createComponent({ createComponent({
......
...@@ -26,19 +26,19 @@ describe('DimDisableContainer component', () => { ...@@ -26,19 +26,19 @@ describe('DimDisableContainer component', () => {
}); });
it('renders title slot component', () => { it('renders title slot component', () => {
expect(wrapper.contains('h1')).toBe(true); expect(wrapper.find('h1').exists()).toBe(true);
}); });
it('renders default slot component', () => { it('renders default slot component', () => {
expect(wrapper.contains('main')).toBe(true); expect(wrapper.find('main').exists()).toBe(true);
}); });
it('does not render disabled slot component', () => { it('does not render disabled slot component', () => {
expect(wrapper.contains('span')).toBe(false); expect(wrapper.find('span').exists()).toBe(false);
}); });
it('does not render dim overlay', () => { it('does not render dim overlay', () => {
expect(wrapper.contains("[data-testid='overlay']")).toBe(false); expect(wrapper.find("[data-testid='overlay']").exists()).toBe(false);
}); });
describe('give disabled is true', () => { describe('give disabled is true', () => {
...@@ -51,19 +51,19 @@ describe('DimDisableContainer component', () => { ...@@ -51,19 +51,19 @@ describe('DimDisableContainer component', () => {
}); });
it('renders title slot component', () => { it('renders title slot component', () => {
expect(wrapper.contains('h1')).toBe(true); expect(wrapper.find('h1').exists()).toBe(true);
}); });
it('does not render default slot component', () => { it('does not render default slot component', () => {
expect(wrapper.contains('main')).toBe(false); expect(wrapper.find('main').exists()).toBe(false);
}); });
it('renders disabled slot component', () => { it('renders disabled slot component', () => {
expect(wrapper.contains('span')).toBe(true); expect(wrapper.find('span').exists()).toBe(true);
}); });
it('renders dim overlay', () => { it('renders dim overlay', () => {
expect(wrapper.contains("[data-testid='overlay']")).toBe(true); expect(wrapper.find("[data-testid='overlay']").exists()).toBe(true);
}); });
}); });
}); });
...@@ -51,7 +51,7 @@ describe('~/feature_flags/components/strategy_parameters.vue', () => { ...@@ -51,7 +51,7 @@ describe('~/feature_flags/components/strategy_parameters.vue', () => {
}); });
it('should show the correct component', () => { it('should show the correct component', () => {
expect(wrapper.contains(component)).toBe(true); expect(wrapper.find(component).exists()).toBe(true);
}); });
it('should emit changes from the lower component', () => { it('should emit changes from the lower component', () => {
......
...@@ -138,7 +138,7 @@ describe('InviteMembersBanner', () => { ...@@ -138,7 +138,7 @@ describe('InviteMembersBanner', () => {
}); });
it('does not render the banner', () => { it('does not render the banner', () => {
expect(wrapper.contains(GlBanner)).toBe(false); expect(wrapper.find(GlBanner).exists()).toBe(false);
}); });
}); });
}); });
...@@ -44,7 +44,7 @@ describe('ItemStats', () => { ...@@ -44,7 +44,7 @@ describe('ItemStats', () => {
expect(findItemStatsValue().exists()).toBe(true); expect(findItemStatsValue().exists()).toBe(true);
expect(findItemStatsValue().props('cssClass')).toBe('project-stars'); expect(findItemStatsValue().props('cssClass')).toBe('project-stars');
expect(wrapper.contains('.last-updated')).toBe(true); expect(wrapper.find('.last-updated').exists()).toBe(true);
}); });
}); });
}); });
...@@ -98,10 +98,10 @@ describe('Releases App ', () => { ...@@ -98,10 +98,10 @@ describe('Releases App ', () => {
}); });
it('renders loading icon', () => { it('renders loading icon', () => {
expect(wrapper.contains('.js-loading')).toBe(true); expect(wrapper.find('.js-loading').exists()).toBe(true);
expect(wrapper.contains('.js-empty-state')).toBe(false); expect(wrapper.find('.js-empty-state').exists()).toBe(false);
expect(wrapper.contains('.js-success-state')).toBe(false); expect(wrapper.find('.js-success-state').exists()).toBe(false);
expect(wrapper.contains(ReleasesPagination)).toBe(false); expect(wrapper.find(ReleasesPagination).exists()).toBe(false);
}); });
}); });
...@@ -115,10 +115,10 @@ describe('Releases App ', () => { ...@@ -115,10 +115,10 @@ describe('Releases App ', () => {
}); });
it('renders success state', () => { it('renders success state', () => {
expect(wrapper.contains('.js-loading')).toBe(false); expect(wrapper.find('.js-loading').exists()).toBe(false);
expect(wrapper.contains('.js-empty-state')).toBe(false); expect(wrapper.find('.js-empty-state').exists()).toBe(false);
expect(wrapper.contains('.js-success-state')).toBe(true); expect(wrapper.find('.js-success-state').exists()).toBe(true);
expect(wrapper.contains(ReleasesPagination)).toBe(true); expect(wrapper.find(ReleasesPagination).exists()).toBe(true);
}); });
}); });
...@@ -132,10 +132,10 @@ describe('Releases App ', () => { ...@@ -132,10 +132,10 @@ describe('Releases App ', () => {
}); });
it('renders success state', () => { it('renders success state', () => {
expect(wrapper.contains('.js-loading')).toBe(false); expect(wrapper.find('.js-loading').exists()).toBe(false);
expect(wrapper.contains('.js-empty-state')).toBe(false); expect(wrapper.find('.js-empty-state').exists()).toBe(false);
expect(wrapper.contains('.js-success-state')).toBe(true); expect(wrapper.find('.js-success-state').exists()).toBe(true);
expect(wrapper.contains(ReleasesPagination)).toBe(true); expect(wrapper.find(ReleasesPagination).exists()).toBe(true);
}); });
}); });
...@@ -147,9 +147,9 @@ describe('Releases App ', () => { ...@@ -147,9 +147,9 @@ describe('Releases App ', () => {
}); });
it('renders empty state', () => { it('renders empty state', () => {
expect(wrapper.contains('.js-loading')).toBe(false); expect(wrapper.find('.js-loading').exists()).toBe(false);
expect(wrapper.contains('.js-empty-state')).toBe(true); expect(wrapper.find('.js-empty-state').exists()).toBe(true);
expect(wrapper.contains('.js-success-state')).toBe(false); expect(wrapper.find('.js-success-state').exists()).toBe(false);
}); });
}); });
......
...@@ -189,8 +189,8 @@ describe('AuthorToken', () => { ...@@ -189,8 +189,8 @@ describe('AuthorToken', () => {
suggestionsSegment.vm.$emit('activate'); suggestionsSegment.vm.$emit('activate');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.contains(GlFilteredSearchSuggestion)).toBe(false); expect(wrapper.find(GlFilteredSearchSuggestion).exists()).toBe(false);
expect(wrapper.contains(GlDropdownDivider)).toBe(false); expect(wrapper.find(GlDropdownDivider).exists()).toBe(false);
}); });
it('renders `DEFAULT_LABEL_ANY` as default suggestions', async () => { it('renders `DEFAULT_LABEL_ANY` as default suggestions', async () => {
......
...@@ -189,8 +189,8 @@ describe('BranchToken', () => { ...@@ -189,8 +189,8 @@ describe('BranchToken', () => {
}); });
await showSuggestions(); await showSuggestions();
expect(wrapper.contains(GlFilteredSearchSuggestion)).toBe(false); expect(wrapper.find(GlFilteredSearchSuggestion).exists()).toBe(false);
expect(wrapper.contains(GlDropdownDivider)).toBe(false); expect(wrapper.find(GlDropdownDivider).exists()).toBe(false);
}); });
it('renders no suggestions as default', async () => { it('renders no suggestions as default', async () => {
......
...@@ -216,8 +216,8 @@ describe('LabelToken', () => { ...@@ -216,8 +216,8 @@ describe('LabelToken', () => {
suggestionsSegment.vm.$emit('activate'); suggestionsSegment.vm.$emit('activate');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.contains(GlFilteredSearchSuggestion)).toBe(false); expect(wrapper.find(GlFilteredSearchSuggestion).exists()).toBe(false);
expect(wrapper.contains(GlDropdownDivider)).toBe(false); expect(wrapper.find(GlDropdownDivider).exists()).toBe(false);
}); });
it('renders `DEFAULT_LABELS` as default suggestions', async () => { it('renders `DEFAULT_LABELS` as default suggestions', async () => {
......
...@@ -196,8 +196,8 @@ describe('MilestoneToken', () => { ...@@ -196,8 +196,8 @@ describe('MilestoneToken', () => {
suggestionsSegment.vm.$emit('activate'); suggestionsSegment.vm.$emit('activate');
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.contains(GlFilteredSearchSuggestion)).toBe(false); expect(wrapper.find(GlFilteredSearchSuggestion).exists()).toBe(false);
expect(wrapper.contains(GlDropdownDivider)).toBe(false); expect(wrapper.find(GlDropdownDivider).exists()).toBe(false);
}); });
it('renders `DEFAULT_MILESTONES` as default suggestions', async () => { it('renders `DEFAULT_MILESTONES` as default suggestions', async () => {
......
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