summaryrefslogtreecommitdiff
path: root/spec/frontend/notes
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-09 21:09:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-09 21:09:19 +0000
commit254ec28f5448f6f353cd98f637985de3d1405854 (patch)
tree1c84ed7b7dd32db96454af034cd6c7e90699e76d /spec/frontend/notes
parent141902c04943d5fb43c014b8cf42af60a3bc0cdf (diff)
downloadgitlab-ce-254ec28f5448f6f353cd98f637985de3d1405854.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/notes')
-rw-r--r--spec/frontend/notes/components/note_header_spec.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/frontend/notes/components/note_header_spec.js b/spec/frontend/notes/components/note_header_spec.js
index 6544ad3e1fe..642ab5138dc 100644
--- a/spec/frontend/notes/components/note_header_spec.js
+++ b/spec/frontend/notes/components/note_header_spec.js
@@ -1,6 +1,7 @@
import { shallowMount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import NoteHeader from '~/notes/components/note_header.vue';
+import GitlabTeamMemberBadge from '~/vue_shared/components/user_avatar/badges/gitlab_team_member_badge.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
@@ -17,6 +18,15 @@ describe('NoteHeader component', () => {
const findActionText = () => wrapper.find({ ref: 'actionText' });
const findTimestamp = () => wrapper.find({ ref: 'noteTimestamp' });
+ const author = {
+ avatar_url: null,
+ id: 1,
+ name: 'Root',
+ path: '/root',
+ state: 'active',
+ username: 'root',
+ };
+
const createComponent = props => {
wrapper = shallowMount(NoteHeader, {
localVue,
@@ -83,16 +93,7 @@ describe('NoteHeader component', () => {
});
it('renders an author link if author is passed to props', () => {
- createComponent({
- author: {
- avatar_url: null,
- id: 1,
- name: 'Root',
- path: '/root',
- state: 'active',
- username: 'root',
- },
- });
+ createComponent({ author });
expect(wrapper.find('.js-user-link').exists()).toBe(true);
});
@@ -138,4 +139,18 @@ describe('NoteHeader component', () => {
expect(actions.setTargetNoteHash).toHaveBeenCalled();
});
});
+
+ test.each`
+ props | expected | message1 | message2
+ ${{ author: { ...author, is_gitlab_employee: true } }} | ${true} | ${'renders'} | ${'true'}
+ ${{ author: { ...author, is_gitlab_employee: false } }} | ${false} | ${"doesn't render"} | ${'false'}
+ ${{ author }} | ${false} | ${"doesn't render"} | ${'undefined'}
+ `(
+ '$message1 GitLab team member badge when `is_gitlab_employee` is $message2',
+ ({ props, expected }) => {
+ createComponent(props);
+
+ expect(wrapper.find(GitlabTeamMemberBadge).exists()).toBe(expected);
+ },
+ );
});