diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/frontend/boards/components | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) | |
download | gitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/frontend/boards/components')
5 files changed, 65 insertions, 18 deletions
diff --git a/spec/frontend/boards/components/board_content_sidebar_spec.js b/spec/frontend/boards/components/board_content_sidebar_spec.js index 7e35c39cd48..0d5b1d16e30 100644 --- a/spec/frontend/boards/components/board_content_sidebar_spec.js +++ b/spec/frontend/boards/components/board_content_sidebar_spec.js @@ -12,7 +12,7 @@ import SidebarDateWidget from '~/sidebar/components/date/sidebar_date_widget.vue import SidebarSeverity from '~/sidebar/components/severity/sidebar_severity.vue'; import SidebarSubscriptionsWidget from '~/sidebar/components/subscriptions/sidebar_subscriptions_widget.vue'; import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue'; -import SidebarLabelsWidget from '~/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue'; +import SidebarLabelsWidget from '~/sidebar/components/labels/labels_select_widget/labels_select_root.vue'; import { mockActiveIssue, mockIssue, mockIssueGroupPath, mockIssueProjectPath } from '../mock_data'; Vue.use(Vuex); @@ -146,6 +146,20 @@ describe('BoardContentSidebar', () => { expect(wrapper.findComponent(SidebarSeverity).exists()).toBe(false); }); + it('does not render SidebarHealthStatusWidget', async () => { + const SidebarHealthStatusWidget = ( + await import('ee_component/sidebar/components/health_status/sidebar_health_status_widget.vue') + ).default; + expect(wrapper.findComponent(SidebarHealthStatusWidget).exists()).toBe(false); + }); + + it('does not render SidebarWeightWidget', async () => { + const SidebarWeightWidget = ( + await import('ee_component/sidebar/components/weight/sidebar_weight_widget.vue') + ).default; + expect(wrapper.findComponent(SidebarWeightWidget).exists()).toBe(false); + }); + describe('when we emit close', () => { let toggleBoardItem; diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js index b2138700602..82e7ab48e7d 100644 --- a/spec/frontend/boards/components/board_content_spec.js +++ b/spec/frontend/boards/components/board_content_spec.js @@ -123,15 +123,39 @@ describe('BoardContent', () => { expect(wrapper.findComponent(GlAlert).exists()).toBe(false); }); - it('resizes the list on resize', async () => { + it('on small screens, sets board container height to full height', async () => { window.innerHeight = 1000; + window.innerWidth = 767; jest.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ top: 100 }); wrapper.vm.resizeObserver.trigger(); await nextTick(); - expect(wrapper.findComponent({ ref: 'list' }).attributes('style')).toBe('height: 900px;'); + const style = wrapper.findComponent({ ref: 'list' }).attributes('style'); + + expect(style).toBe('height: 1000px;'); + }); + + it('on large screens, sets board container height fill area below filters', async () => { + window.innerHeight = 1000; + window.innerWidth = 768; + jest.spyOn(Element.prototype, 'getBoundingClientRect').mockReturnValue({ top: 100 }); + + wrapper.vm.resizeObserver.trigger(); + + await nextTick(); + + const style = wrapper.findComponent({ ref: 'list' }).attributes('style'); + + expect(style).toBe('height: 900px;'); + }); + + it('sets delay and delayOnTouchOnly attributes on board list', () => { + const listEl = wrapper.findComponent({ ref: 'list' }); + + expect(listEl.attributes('delay')).toBe('100'); + expect(listEl.attributes('delayontouchonly')).toBe('true'); }); }); diff --git a/spec/frontend/boards/components/board_filtered_search_spec.js b/spec/frontend/boards/components/board_filtered_search_spec.js index 6f17e4193a3..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'; @@ -30,7 +30,7 @@ describe('BoardFilteredSearch', () => { { icon: 'labels', title: TOKEN_TITLE_LABEL, - type: 'label', + type: TOKEN_TYPE_LABEL, operators: [ { value: '=', description: 'is' }, { value: '!=', description: 'is not' }, @@ -43,15 +43,15 @@ describe('BoardFilteredSearch', () => { { icon: 'pencil', title: TOKEN_TITLE_AUTHOR, - type: 'author', + type: TOKEN_TYPE_AUTHOR, operators: [ { value: '=', description: 'is' }, { value: '!=', description: 'is not' }, ], symbol: '@', - token: AuthorToken, + token: UserToken, unique: true, - fetchAuthors: () => new Promise(() => {}), + fetchUsers: () => new Promise(() => {}), }, ]; @@ -109,7 +109,7 @@ describe('BoardFilteredSearch', () => { createComponent({ props: { eeFilters: { labelName: ['label'] } } }); expect(findFilteredSearch().props('initialFilterValue')).toEqual([ - { type: 'label', value: { data: 'label', operator: '=' } }, + { type: TOKEN_TYPE_LABEL, value: { data: 'label', operator: '=' } }, ]); }); }); @@ -158,7 +158,9 @@ describe('BoardFilteredSearch', () => { ['None', url('None')], ['Any', url('Any')], ])('sets the url param %s', (assigneeParam, expected) => { - const mockFilters = [{ type: 'assignee', value: { data: assigneeParam, operator: '=' } }]; + const mockFilters = [ + { type: TOKEN_TYPE_ASSIGNEE, value: { data: assigneeParam, operator: '=' } }, + ]; jest.spyOn(urlUtility, 'updateHistory'); findFilteredSearch().vm.$emit('onFilter', mockFilters); 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, ); diff --git a/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js b/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js index 5c435643425..e2e4baefad0 100644 --- a/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js +++ b/spec/frontend/boards/components/sidebar/board_sidebar_time_tracker_spec.js @@ -42,13 +42,20 @@ describe('BoardSidebarTimeTracker', () => { wrapper = null; }); - it.each([[true], [false]])( - 'renders IssuableTimeTracker with correct spent and estimated time (timeTrackingLimitToHours=%s)', - (timeTrackingLimitToHours) => { - createComponent({ provide: { timeTrackingLimitToHours } }); + it.each` + timeTrackingLimitToHours | canUpdate + ${true} | ${false} + ${true} | ${true} + ${false} | ${false} + ${false} | ${true} + `( + 'renders IssuableTimeTracker with correct spent and estimated time (timeTrackingLimitToHours=$timeTrackingLimitToHours, canUpdate=$canUpdate)', + ({ timeTrackingLimitToHours, canUpdate }) => { + createComponent({ provide: { timeTrackingLimitToHours, canUpdate } }); expect(wrapper.findComponent(IssuableTimeTracker).props()).toEqual({ limitToHours: timeTrackingLimitToHours, + canAddTimeEntries: canUpdate, showCollapsed: false, issuableId: '1', issuableIid: '1', |