diff options
Diffstat (limited to 'spec/frontend/boards/board_list_spec.js')
-rw-r--r-- | spec/frontend/boards/board_list_spec.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/spec/frontend/boards/board_list_spec.js b/spec/frontend/boards/board_list_spec.js index 1981ed5ab7f..fd9d2b6823d 100644 --- a/spec/frontend/boards/board_list_spec.js +++ b/spec/frontend/boards/board_list_spec.js @@ -1,6 +1,8 @@ import Draggable from 'vuedraggable'; +import { nextTick } from 'vue'; import { DraggableItemTypes } from 'ee_else_ce/boards/constants'; import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame'; +import waitForPromises from 'helpers/wait_for_promises'; import createComponent from 'jest/boards/board_list_helper'; import BoardCard from '~/boards/components/board_card.vue'; import eventHub from '~/boards/eventhub'; @@ -64,14 +66,14 @@ describe('Board list component', () => { it('shows new issue form', async () => { wrapper.vm.toggleForm(); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-new-issue-form').exists()).toBe(true); }); it('shows new issue form after eventhub event', async () => { eventHub.$emit(`toggle-issue-form-${wrapper.vm.list.id}`); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-new-issue-form').exists()).toBe(true); }); @@ -85,7 +87,7 @@ describe('Board list component', () => { it('shows count list item', async () => { wrapper.vm.showCount = true; - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-list-count').exists()).toBe(true); expect(wrapper.find('.board-list-count').text()).toBe('Showing all issues'); @@ -94,7 +96,7 @@ describe('Board list component', () => { it('sets data attribute with invalid id', async () => { wrapper.vm.showCount = true; - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.board-list-count').attributes('data-issue-id')).toBe('-1'); }); }); @@ -104,10 +106,6 @@ describe('Board list component', () => { fetchItemsForList: jest.fn(), }; - beforeEach(() => { - wrapper = createComponent(); - }); - it('does not load issues if already loading', () => { wrapper = createComponent({ actions, @@ -126,20 +124,23 @@ describe('Board list component', () => { }, }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(findIssueCountLoadingIcon().exists()).toBe(true); }); it('shows how many more issues to load', async () => { - // wrapper.vm.showCount = true; wrapper = createComponent({ data: { showCount: true, }, }); - await wrapper.vm.$nextTick(); + await nextTick(); + await waitForPromises(); + await nextTick(); + await nextTick(); + expect(wrapper.find('.board-list-count').text()).toBe('Showing 1 of 20 issues'); }); }); @@ -155,7 +156,7 @@ describe('Board list component', () => { it('sets background to bg-danger-100', async () => { wrapper.setProps({ list: { issuesCount: 4, maxIssueCount: 3 } }); - await wrapper.vm.$nextTick(); + await nextTick(); expect(wrapper.find('.bg-danger-100').exists()).toBe(true); }); }); |