diff options
Diffstat (limited to 'spec/frontend/frequent_items')
4 files changed, 17 insertions, 17 deletions
diff --git a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js index eef5dc86c1a..e6673fa78ec 100644 --- a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js @@ -1,7 +1,7 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { trimText } from 'helpers/text_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import frequentItemsListItemComponent from '~/frequent_items/components/frequent_items_list_item.vue'; @@ -16,18 +16,18 @@ describe('FrequentItemsListItemComponent', () => { let trackingSpy; let store; - const findTitle = () => wrapper.find({ ref: 'frequentItemsItemTitle' }); + const findTitle = () => wrapper.findByTestId('frequent-items-item-title'); const findAvatar = () => wrapper.findComponent(ProjectAvatar); - const findAllTitles = () => wrapper.findAll({ ref: 'frequentItemsItemTitle' }); - const findNamespace = () => wrapper.find({ ref: 'frequentItemsItemNamespace' }); + const findAllTitles = () => wrapper.findAllByTestId('frequent-items-item-title'); + const findNamespace = () => wrapper.findByTestId('frequent-items-item-namespace'); const findAllButtons = () => wrapper.findAllComponents(GlButton); - const findAllNamespace = () => wrapper.findAll({ ref: 'frequentItemsItemNamespace' }); + const findAllNamespace = () => wrapper.findAllByTestId('frequent-items-item-namespace'); const findAllAvatars = () => wrapper.findAllComponents(ProjectAvatar); const findAllMetadataContainers = () => - wrapper.findAll({ ref: 'frequentItemsItemMetadataContainer' }); + wrapper.findAllByTestId('frequent-items-item-metadata-container'); const createComponent = (props = {}) => { - wrapper = shallowMount(frequentItemsListItemComponent, { + wrapper = shallowMountExtended(frequentItemsListItemComponent, { store, propsData: { itemId: mockProject.id, diff --git a/spec/frontend/frequent_items/components/frequent_items_list_spec.js b/spec/frontend/frequent_items/components/frequent_items_list_spec.js index beaab1913d0..9f08a432a3d 100644 --- a/spec/frontend/frequent_items/components/frequent_items_list_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_list_spec.js @@ -1,6 +1,6 @@ -import { mount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; import frequentItemsListComponent from '~/frequent_items/components/frequent_items_list.vue'; import frequentItemsListItemComponent from '~/frequent_items/components/frequent_items_list_item.vue'; import { createStore } from '~/frequent_items/store'; @@ -12,7 +12,7 @@ describe('FrequentItemsListComponent', () => { let wrapper; const createComponent = (props = {}) => { - wrapper = mount(frequentItemsListComponent, { + wrapper = mountExtended(frequentItemsListComponent, { store: createStore(), propsData: { namespace: 'projects', @@ -94,8 +94,8 @@ describe('FrequentItemsListComponent', () => { await nextTick(); expect(wrapper.classes('frequent-items-list-container')).toBe(true); - expect(wrapper.findAll({ ref: 'frequentItemsList' })).toHaveLength(1); - expect(wrapper.findAll(frequentItemsListItemComponent)).toHaveLength(5); + expect(wrapper.findAllByTestId('frequent-items-list')).toHaveLength(1); + expect(wrapper.findAllComponents(frequentItemsListItemComponent)).toHaveLength(5); }); it('should render component element with empty message', async () => { @@ -105,7 +105,7 @@ describe('FrequentItemsListComponent', () => { await nextTick(); expect(wrapper.vm.$el.querySelectorAll('li.section-empty')).toHaveLength(1); - expect(wrapper.findAll(frequentItemsListItemComponent)).toHaveLength(0); + expect(wrapper.findAllComponents(frequentItemsListItemComponent)).toHaveLength(0); }); }); }); diff --git a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js index d0a4cf70f5f..94fc97b82c2 100644 --- a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js @@ -23,7 +23,7 @@ describe('FrequentItemsSearchInputComponent', () => { }, }); - const findSearchBoxByType = () => wrapper.find(GlSearchBoxByType); + const findSearchBoxByType = () => wrapper.findComponent(GlSearchBoxByType); beforeEach(() => { store = createStore(); diff --git a/spec/frontend/frequent_items/utils_spec.js b/spec/frontend/frequent_items/utils_spec.js index 33c655a6ffd..8d4c89bd48f 100644 --- a/spec/frontend/frequent_items/utils_spec.js +++ b/spec/frontend/frequent_items/utils_spec.js @@ -10,25 +10,25 @@ import { mockProject, unsortedFrequentItems, sortedFrequentItems } from './mock_ describe('Frequent Items utils spec', () => { describe('isMobile', () => { - it('returns true when the screen is medium ', () => { + it('returns true when the screen is medium', () => { jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('md'); expect(isMobile()).toBe(true); }); - it('returns true when the screen is small ', () => { + it('returns true when the screen is small', () => { jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('sm'); expect(isMobile()).toBe(true); }); - it('returns true when the screen is extra-small ', () => { + it('returns true when the screen is extra-small', () => { jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('xs'); expect(isMobile()).toBe(true); }); - it('returns false when the screen is larger than medium ', () => { + it('returns false when the screen is larger than medium', () => { jest.spyOn(bp, 'getBreakpointSize').mockReturnValue('lg'); expect(isMobile()).toBe(false); |