diff options
Diffstat (limited to 'spec/frontend/notes/components/note_actions_spec.js')
-rw-r--r-- | spec/frontend/notes/components/note_actions_spec.js | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/spec/frontend/notes/components/note_actions_spec.js b/spec/frontend/notes/components/note_actions_spec.js index 97d1752726b..a79c3bbacb7 100644 --- a/spec/frontend/notes/components/note_actions_spec.js +++ b/spec/frontend/notes/components/note_actions_spec.js @@ -35,8 +35,12 @@ describe('noteActions', () => { canEdit: true, canAwardEmoji: true, canReportAsAbuse: true, + isAuthor: true, + isContributor: false, + noteableType: 'MergeRequest', noteId: '539', noteUrl: `${TEST_HOST}/group/project/-/merge_requests/1#note_1`, + projectName: 'project', reportAbusePath: `${TEST_HOST}/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_539&user_id=26`, showReply: false, }; @@ -60,15 +64,43 @@ describe('noteActions', () => { wrapper = shallowMountNoteActions(props); }); + it('should render noteable author badge', () => { + expect( + wrapper + .findAll('.note-role') + .at(0) + .text() + .trim(), + ).toEqual('Author'); + }); + it('should render access level badge', () => { expect( wrapper - .find('.note-role') + .findAll('.note-role') + .at(1) .text() .trim(), ).toEqual(props.accessLevel); }); + it('should render contributor badge', () => { + wrapper.setProps({ + accessLevel: null, + isContributor: true, + }); + + return wrapper.vm.$nextTick().then(() => { + expect( + wrapper + .findAll('.note-role') + .at(1) + .text() + .trim(), + ).toBe('Contributor'); + }); + }); + it('should render emoji link', () => { expect(wrapper.find('.js-add-award').exists()).toBe(true); expect(wrapper.find('.js-add-award').attributes('data-position')).toBe('right'); |