diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-29 18:09:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-29 18:09:58 +0300 |
commit | b6c37979bc2f585f8b3ecd523e50a8caebf10c2f (patch) | |
tree | ababf3206f1b604ba99b4c5e0ba18efd1a028736 /spec/frontend/sidebar | |
parent | c6c658b674a37d73ba2f7d8e5808fe4d67d09919 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/sidebar')
-rw-r--r-- | spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js | 12 | ||||
-rw-r--r-- | spec/frontend/sidebar/issuable_assignees_spec.js | 23 |
2 files changed, 26 insertions, 9 deletions
diff --git a/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js b/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js index 88015ed42a3..3644a51c7fd 100644 --- a/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js +++ b/spec/frontend/sidebar/components/assignees/sidebar_assignees_widget_spec.js @@ -65,6 +65,7 @@ describe('Sidebar assignees widget', () => { issuableId: 0, fullPath: '/mygroup/myProject', allowMultipleAssignees: true, + editable: true, ...props, }, provide: { @@ -350,6 +351,17 @@ describe('Sidebar assignees widget', () => { }); }); + describe('when issuable is not editable by the user', () => { + beforeEach(async () => { + createComponent({ props: { editable: false } }); + await waitForPromises(); + }); + + it('passes editable prop as false to IssuableAssignees', () => { + expect(findAssignees().props('editable')).toBe(false); + }); + }); + it('includes the real-time assignees component', async () => { createComponent(); await waitForPromises(); diff --git a/spec/frontend/sidebar/issuable_assignees_spec.js b/spec/frontend/sidebar/issuable_assignees_spec.js index 3563d478f3f..dc59b68bbd4 100644 --- a/spec/frontend/sidebar/issuable_assignees_spec.js +++ b/spec/frontend/sidebar/issuable_assignees_spec.js @@ -12,6 +12,7 @@ describe('IssuableAssignees', () => { }, propsData: { users: [], + editable: true, ...props, }, }); @@ -25,15 +26,19 @@ describe('IssuableAssignees', () => { }); describe('when no assignees are present', () => { - it('renders "None - assign yourself" when user is logged in', () => { - createComponent({ signedIn: true }); - expect(findEmptyAssignee().text()).toBe('None - assign yourself'); - }); - - it('renders "None" when user is not logged in', () => { - createComponent(); - expect(findEmptyAssignee().text()).toBe('None'); - }); + it.each` + signedIn | editable | message + ${true} | ${true} | ${'None - assign yourself'} + ${true} | ${false} | ${'None'} + ${false} | ${true} | ${'None'} + ${false} | ${false} | ${'None'} + `( + 'renders "$message" when signedIn is $signedIn and editable is $editable', + ({ signedIn, editable, message }) => { + createComponent({ signedIn, editable }); + expect(findEmptyAssignee().text()).toBe(message); + }, + ); }); describe('when assignees are present', () => { |