diff options
Diffstat (limited to 'spec/frontend/boards/mock_data.js')
-rw-r--r-- | spec/frontend/boards/mock_data.js | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/spec/frontend/boards/mock_data.js b/spec/frontend/boards/mock_data.js index 8fcad99f8a7..a081a60166b 100644 --- a/spec/frontend/boards/mock_data.js +++ b/spec/frontend/boards/mock_data.js @@ -2,12 +2,11 @@ import { GlFilteredSearchToken } from '@gitlab/ui'; import { keyBy } from 'lodash'; import { ListType } from '~/boards/constants'; import { __ } from '~/locale'; -import { DEFAULT_MILESTONES_GRAPHQL } from '~/vue_shared/components/filtered_search_bar/constants'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; -import WeightToken from '~/vue_shared/components/filtered_search_bar/tokens/weight_token.vue'; +import ReleaseToken from '~/vue_shared/components/filtered_search_bar/tokens/release_token.vue'; export const boardObj = { id: 1, @@ -21,7 +20,6 @@ export const listObj = { position: 0, title: 'Test', list_type: 'label', - weight: 3, label: { id: 5000, title: 'Test', @@ -154,7 +152,6 @@ export const rawIssue = { iid: '27', dueDate: null, timeEstimate: 0, - weight: null, confidential: false, referencePath: 'gitlab-org/test-subgroup/gitlab-test#27', path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/27', @@ -184,7 +181,6 @@ export const mockIssue = { title: 'Issue 1', dueDate: null, timeEstimate: 0, - weight: null, confidential: false, referencePath: `${mockIssueFullPath}#27`, path: `/${mockIssueFullPath}/-/issues/27`, @@ -216,7 +212,6 @@ export const mockIssue2 = { title: 'Issue 2', dueDate: null, timeEstimate: 0, - weight: null, confidential: false, referencePath: 'gitlab-org/test-subgroup/gitlab-test#28', path: '/gitlab-org/test-subgroup/gitlab-test/-/issues/28', @@ -234,7 +229,6 @@ export const mockIssue3 = { referencePath: '#29', dueDate: null, timeEstimate: 0, - weight: null, confidential: false, path: '/gitlab-org/gitlab-test/-/issues/28', assignees, @@ -249,7 +243,6 @@ export const mockIssue4 = { referencePath: '#30', dueDate: null, timeEstimate: 0, - weight: null, confidential: false, path: '/gitlab-org/gitlab-test/-/issues/28', assignees, @@ -551,7 +544,7 @@ export const mockMoveData = { }; export const mockEmojiToken = { - type: 'my_reaction_emoji', + type: 'my-reaction', icon: 'thumb-up', title: 'My-Reaction', unique: true, @@ -559,11 +552,24 @@ export const mockEmojiToken = { fetchEmojis: expect.any(Function), }; -export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) => [ +export const mockConfidentialToken = { + type: 'confidential', + icon: 'eye-slash', + title: 'Confidential', + unique: true, + token: GlFilteredSearchToken, + operators: [{ value: '=', description: 'is' }], + options: [ + { icon: 'eye-slash', value: 'yes', title: 'Yes' }, + { icon: 'eye', value: 'no', title: 'No' }, + ], +}; + +export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, isSignedIn) => [ { icon: 'user', title: __('Assignee'), - type: 'assignee_username', + type: 'assignee', operators: [ { value: '=', description: 'is' }, { value: '!=', description: 'is not' }, @@ -576,7 +582,7 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) { icon: 'pencil', title: __('Author'), - type: 'author_username', + type: 'author', operators: [ { value: '=', description: 'is' }, { value: '!=', description: 'is not' }, @@ -590,7 +596,7 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) { icon: 'labels', title: __('Label'), - type: 'label_name', + type: 'label', operators: [ { value: '=', description: 'is' }, { value: '!=', description: 'is not' }, @@ -600,21 +606,20 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) symbol: '~', fetchLabels, }, - ...(hasEmoji ? [mockEmojiToken] : []), + ...(isSignedIn ? [mockEmojiToken, mockConfidentialToken] : []), { icon: 'clock', title: __('Milestone'), symbol: '%', - type: 'milestone_title', + type: 'milestone', token: MilestoneToken, unique: true, - defaultMilestones: DEFAULT_MILESTONES_GRAPHQL, fetchMilestones, }, { icon: 'issues', title: __('Type'), - type: 'types', + type: 'type', token: GlFilteredSearchToken, unique: true, options: [ @@ -623,11 +628,11 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones, hasEmoji) ], }, { - icon: 'weight', - title: __('Weight'), - type: 'weight', - token: WeightToken, - unique: true, + type: 'release', + title: __('Release'), + icon: 'rocket', + token: ReleaseToken, + fetchReleases: expect.any(Function), }, ]; @@ -670,3 +675,14 @@ export const mockGroupLabelsResponse = { }, }, }; + +export const boardListQueryResponse = (issuesCount = 20) => ({ + data: { + boardList: { + __typename: 'BoardList', + id: 'gid://gitlab/BoardList/5', + totalWeight: 5, + issuesCount, + }, + }, +}); |