diff options
Diffstat (limited to 'spec/frontend/boards/components')
3 files changed, 23 insertions, 21 deletions
diff --git a/spec/frontend/boards/components/board_card_move_to_position_spec.js b/spec/frontend/boards/components/board_card_move_to_position_spec.js index 46e0724fc4a..8dee3c77787 100644 --- a/spec/frontend/boards/components/board_card_move_to_position_spec.js +++ b/spec/frontend/boards/components/board_card_move_to_position_spec.js @@ -1,18 +1,17 @@ import { shallowMount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; -import { GlCollapsibleListbox, GlListboxItem } from '@gitlab/ui'; +import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import BoardCardMoveToPosition from '~/boards/components/board_card_move_to_position.vue'; import { mockList, mockIssue2, mockIssue, mockIssue3, mockIssue4 } from 'jest/boards/mock_data'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; -import { BOARD_CARD_MOVE_TO_POSITION_OPTIONS } from '~/boards/constants'; Vue.use(Vuex); const dropdownOptions = [ - BOARD_CARD_MOVE_TO_POSITION_OPTIONS[0].text, - BOARD_CARD_MOVE_TO_POSITION_OPTIONS[1].text, + BoardCardMoveToPosition.i18n.moveToStartText, + BoardCardMoveToPosition.i18n.moveToEndText, ]; describe('Board Card Move to position', () => { @@ -54,7 +53,8 @@ describe('Board Card Move to position', () => { ...propsData, }, stubs: { - GlCollapsibleListbox, + GlDropdown, + GlDropdownItem, }, }); }; @@ -68,8 +68,8 @@ describe('Board Card Move to position', () => { wrapper.destroy(); }); - const findMoveToPositionDropdown = () => wrapper.findComponent(GlCollapsibleListbox); - const findDropdownItems = () => findMoveToPositionDropdown().findAllComponents(GlListboxItem); + const findMoveToPositionDropdown = () => wrapper.findComponent(GlDropdown); + const findDropdownItems = () => findMoveToPositionDropdown().findAllComponents(GlDropdownItem); const findDropdownItemAtIndex = (index) => findDropdownItems().at(index); describe('Dropdown', () => { @@ -80,6 +80,7 @@ describe('Board Card Move to position', () => { }); it('is opened on the click of vertical ellipsis and has 2 dropdown items when number of list items < 10', () => { + findMoveToPositionDropdown().vm.$emit('click'); expect(findDropdownItems()).toHaveLength(dropdownOptions.length); }); }); @@ -96,17 +97,18 @@ describe('Board Card Move to position', () => { }); it.each` - dropdownIndex | dropdownLabel | trackLabel | positionInList - ${0} | ${BOARD_CARD_MOVE_TO_POSITION_OPTIONS[0].text} | ${'move_to_start'} | ${0} - ${1} | ${BOARD_CARD_MOVE_TO_POSITION_OPTIONS[1].text} | ${'move_to_end'} | ${-1} + dropdownIndex | dropdownLabel | trackLabel | positionInList + ${0} | ${BoardCardMoveToPosition.i18n.moveToStartText} | ${'move_to_start'} | ${0} + ${1} | ${BoardCardMoveToPosition.i18n.moveToEndText} | ${'move_to_end'} | ${-1} `( 'on click of dropdown index $dropdownIndex with label $dropdownLabel should call moveItem action with tracking label $trackLabel', async ({ dropdownIndex, dropdownLabel, trackLabel, positionInList }) => { - await findMoveToPositionDropdown().vm.$emit( - 'select', - BOARD_CARD_MOVE_TO_POSITION_OPTIONS[dropdownIndex].value, - ); + await findMoveToPositionDropdown().vm.$emit('click'); + expect(findDropdownItemAtIndex(dropdownIndex).text()).toBe(dropdownLabel); + await findDropdownItemAtIndex(dropdownIndex).vm.$emit('click', { + stopPropagation: () => {}, + }); await nextTick(); diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js index db94b392694..e80c66f7fb8 100644 --- a/spec/frontend/boards/components/board_filtered_search_spec.js +++ b/spec/frontend/boards/components/board_filtered_search_spec.js @@ -17,7 +17,7 @@ import { TOKEN_TYPE_WEIGHT, } from '~/vue_shared/components/filtered_search_bar/constants'; import FilteredSearchBarRoot from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; -import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; +import UserToken from '~/vue_shared/components/filtered_search_bar/tokens/user_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import { createStore } from '~/boards/stores'; @@ -49,9 +49,9 @@ describe('BoardFilteredSearch', () => { { value: '!=', description: 'is not' }, ], symbol: '@', - token: AuthorToken, + token: UserToken, unique: true, - fetchAuthors: () => new Promise(() => {}), + fetchUsers: () => new Promise(() => {}), }, ]; diff --git a/spec/frontend/boards/components/issue_board_filtered_search_spec.js b/spec/frontend/boards/components/issue_board_filtered_search_spec.js index e4a6a2b8b76..513561307cd 100644 --- a/spec/frontend/boards/components/issue_board_filtered_search_spec.js +++ b/spec/frontend/boards/components/issue_board_filtered_search_spec.js @@ -23,14 +23,14 @@ describe('IssueBoardFilter', () => { }); }; - let fetchAuthorsSpy; + let fetchUsersSpy; let fetchLabelsSpy; beforeEach(() => { - fetchAuthorsSpy = jest.fn(); + fetchUsersSpy = jest.fn(); fetchLabelsSpy = jest.fn(); issueBoardFilters.mockReturnValue({ - fetchAuthors: fetchAuthorsSpy, + fetchUsers: fetchUsersSpy, fetchLabels: fetchLabelsSpy, }); }); @@ -59,7 +59,7 @@ describe('IssueBoardFilter', () => { const tokens = mockTokens( fetchLabelsSpy, - fetchAuthorsSpy, + fetchUsersSpy, wrapper.vm.fetchMilestones, isSignedIn, ); |