diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-10 00:07:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-10 00:07:17 +0300 |
commit | 94a2edbe7984384df4c3fb7efa308af2e0f42d8c (patch) | |
tree | 96b563670ef5d790a4e97f8d153dc667d971ef64 /spec/frontend/boards/components | |
parent | 7d8fc3b6b67a22969cd1fa5cb018fc22e6aa1ade (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/boards/components')
-rw-r--r-- | spec/frontend/boards/components/board_card_move_to_position_spec.js | 30 |
1 files changed, 14 insertions, 16 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 8dee3c77787..46e0724fc4a 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,17 +1,18 @@ import { shallowMount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; -import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; +import { GlCollapsibleListbox, GlListboxItem } 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 = [ - BoardCardMoveToPosition.i18n.moveToStartText, - BoardCardMoveToPosition.i18n.moveToEndText, + BOARD_CARD_MOVE_TO_POSITION_OPTIONS[0].text, + BOARD_CARD_MOVE_TO_POSITION_OPTIONS[1].text, ]; describe('Board Card Move to position', () => { @@ -53,8 +54,7 @@ describe('Board Card Move to position', () => { ...propsData, }, stubs: { - GlDropdown, - GlDropdownItem, + GlCollapsibleListbox, }, }); }; @@ -68,8 +68,8 @@ describe('Board Card Move to position', () => { wrapper.destroy(); }); - const findMoveToPositionDropdown = () => wrapper.findComponent(GlDropdown); - const findDropdownItems = () => findMoveToPositionDropdown().findAllComponents(GlDropdownItem); + const findMoveToPositionDropdown = () => wrapper.findComponent(GlCollapsibleListbox); + const findDropdownItems = () => findMoveToPositionDropdown().findAllComponents(GlListboxItem); const findDropdownItemAtIndex = (index) => findDropdownItems().at(index); describe('Dropdown', () => { @@ -80,7 +80,6 @@ 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); }); }); @@ -97,18 +96,17 @@ describe('Board Card Move to position', () => { }); it.each` - dropdownIndex | dropdownLabel | trackLabel | positionInList - ${0} | ${BoardCardMoveToPosition.i18n.moveToStartText} | ${'move_to_start'} | ${0} - ${1} | ${BoardCardMoveToPosition.i18n.moveToEndText} | ${'move_to_end'} | ${-1} + 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} `( '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('click'); - + await findMoveToPositionDropdown().vm.$emit( + 'select', + BOARD_CARD_MOVE_TO_POSITION_OPTIONS[dropdownIndex].value, + ); expect(findDropdownItemAtIndex(dropdownIndex).text()).toBe(dropdownLabel); - await findDropdownItemAtIndex(dropdownIndex).vm.$emit('click', { - stopPropagation: () => {}, - }); await nextTick(); |