diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-19 18:09:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-19 18:09:36 +0300 |
commit | 8bb837c4d180720d4d923ef2e7bd2c9a46ca97a0 (patch) | |
tree | 7dcb166661ba29fb6cd5935f0db34eee6c935388 /spec/frontend/work_items | |
parent | eef2437c0a359ec3437d31d1b1ea959e54c71458 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/work_items')
-rw-r--r-- | spec/frontend/work_items/components/notes/work_item_add_note_spec.js | 13 | ||||
-rw-r--r-- | spec/frontend/work_items/mock_data.js | 13 |
2 files changed, 25 insertions, 1 deletions
diff --git a/spec/frontend/work_items/components/notes/work_item_add_note_spec.js b/spec/frontend/work_items/components/notes/work_item_add_note_spec.js index 9bb84947db5..e6d20dcb0d9 100644 --- a/spec/frontend/work_items/components/notes/work_item_add_note_spec.js +++ b/spec/frontend/work_items/components/notes/work_item_add_note_spec.js @@ -32,12 +32,14 @@ describe('Work item add note', () => { const findCommentForm = () => wrapper.findComponent(WorkItemCommentForm); const findTextarea = () => wrapper.findByTestId('note-reply-textarea'); + const findWorkItemLockedComponent = () => wrapper.findComponent(WorkItemCommentLocked); const createComponent = async ({ mutationHandler = mutationSuccessHandler, canUpdate = true, + canCreateNote = true, workItemIid = '1', - workItemResponse = workItemByIidResponseFactory({ canUpdate }), + workItemResponse = workItemByIidResponseFactory({ canUpdate, canCreateNote }), signedIn = true, isEditing = true, workItemType = 'Task', @@ -265,4 +267,13 @@ describe('Work item add note', () => { expect(wrapper.attributes('class')).toContain('internal-note'); }); + + describe('when work item`createNote` permission false', () => { + it('cannot add comment', async () => { + await createComponent({ isEditing: false, canCreateNote: false }); + + expect(findWorkItemLockedComponent().exists()).toBe(true); + expect(findCommentForm().exists()).toBe(false); + }); + }); }); diff --git a/spec/frontend/work_items/mock_data.js b/spec/frontend/work_items/mock_data.js index 84e5e76cb4c..a873462ea63 100644 --- a/spec/frontend/work_items/mock_data.js +++ b/spec/frontend/work_items/mock_data.js @@ -110,6 +110,7 @@ export const workItemQueryResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, widgets: [ @@ -214,6 +215,7 @@ export const updateWorkItemMutationResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, reference: 'test-project-path#1', @@ -322,6 +324,7 @@ export const convertWorkItemMutationResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, reference: 'gitlab-org/gitlab-test#1', @@ -418,6 +421,7 @@ export const objectiveType = { export const workItemResponseFactory = ({ canUpdate = false, canDelete = false, + canCreateNote = false, adminParentLink = false, notificationsWidgetPresent = true, currentUserTodosWidgetPresent = true, @@ -473,6 +477,7 @@ export const workItemResponseFactory = ({ updateWorkItem: canUpdate, setWorkItemMetadata: canUpdate, adminParentLink, + createNote: canCreateNote, __typename: 'WorkItemPermissions', }, reference: 'test-project-path#1', @@ -751,6 +756,7 @@ export const createWorkItemMutationResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, reference: 'test-project-path#1', @@ -980,6 +986,7 @@ export const workItemHierarchyEmptyResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, confidential: false, @@ -1029,6 +1036,7 @@ export const workItemHierarchyNoUpdatePermissionResponse = { updateWorkItem: false, setWorkItemMetadata: false, adminParentLink: false, + createNote: false, __typename: 'WorkItemPermissions', }, project: { @@ -1178,6 +1186,7 @@ export const workItemHierarchyResponse = { updateWorkItem: true, setWorkItemMetadata: true, adminParentLink: true, + createNote: true, __typename: 'WorkItemPermissions', }, author: { @@ -1277,6 +1286,7 @@ export const workItemObjectiveWithChild = { updateWorkItem: true, setWorkItemMetadata: true, adminParentLink: true, + createNote: true, __typename: 'WorkItemPermissions', }, author: { @@ -1346,6 +1356,7 @@ export const workItemHierarchyTreeResponse = { updateWorkItem: true, setWorkItemMetadata: true, adminParentLink: true, + createNote: true, __typename: 'WorkItemPermissions', }, confidential: false, @@ -1426,6 +1437,7 @@ export const changeIndirectWorkItemParentMutationResponse = { updateWorkItem: true, setWorkItemMetadata: true, adminParentLink: true, + createNote: true, __typename: 'WorkItemPermissions', }, description: null, @@ -1493,6 +1505,7 @@ export const changeWorkItemParentMutationResponse = { updateWorkItem: true, setWorkItemMetadata: true, adminParentLink: true, + createNote: true, __typename: 'WorkItemPermissions', }, description: null, |