Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-04 15:08:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-04 15:08:38 +0300
commit13f961dce9cbed0a684d694fb1cb9d85946e3be4 (patch)
tree5205e5af13605a2cddbbb1d2153e0b2d68b7fb6a /spec/frontend/design_management/components/design_notes/design_note_spec.js
parentc5a33b5d2b6d0e0622fd12ffeb17b7e859cfc0a8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/design_management/components/design_notes/design_note_spec.js')
-rw-r--r--spec/frontend/design_management/components/design_notes/design_note_spec.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/frontend/design_management/components/design_notes/design_note_spec.js b/spec/frontend/design_management/components/design_notes/design_note_spec.js
index 35fd1273270..93a3e4e4fd7 100644
--- a/spec/frontend/design_management/components/design_notes/design_note_spec.js
+++ b/spec/frontend/design_management/components/design_notes/design_note_spec.js
@@ -1,10 +1,10 @@
-import { shallowMount } from '@vue/test-utils';
import { ApolloMutation } from 'vue-apollo';
import { nextTick } from 'vue';
+import { GlAvatar, GlAvatarLink } from '@gitlab/ui';
+import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import DesignNote from '~/design_management/components/design_notes/design_note.vue';
import DesignReplyForm from '~/design_management/components/design_notes/design_reply_form.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
-import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
const scrollIntoViewMock = jest.fn();
const note = {
@@ -12,6 +12,8 @@ const note = {
author: {
id: 'gid://gitlab/User/1',
username: 'foo-bar',
+ avatarUrl: 'https://gitlab.com/avatar',
+ webUrl: 'https://gitlab.com/user',
},
body: 'test',
userPermissions: {
@@ -30,14 +32,15 @@ const mutate = jest.fn().mockResolvedValue({ data: { updateNote: {} } });
describe('Design note component', () => {
let wrapper;
- const findUserAvatar = () => wrapper.find(UserAvatarLink);
- const findUserLink = () => wrapper.find('.js-user-link');
- const findReplyForm = () => wrapper.find(DesignReplyForm);
- const findEditButton = () => wrapper.find('.js-note-edit');
- const findNoteContent = () => wrapper.find('.js-note-text');
+ const findUserAvatar = () => wrapper.findComponent(GlAvatar);
+ const findUserAvatarLink = () => wrapper.findComponent(GlAvatarLink);
+ const findUserLink = () => wrapper.findByTestId('user-link');
+ const findReplyForm = () => wrapper.findComponent(DesignReplyForm);
+ const findEditButton = () => wrapper.findByTestId('note-edit');
+ const findNoteContent = () => wrapper.findByTestId('note-text');
function createComponent(props = {}, data = { isEditing: false }) {
- wrapper = shallowMount(DesignNote, {
+ wrapper = shallowMountExtended(DesignNote, {
propsData: {
note: {},
...props,
@@ -71,12 +74,24 @@ describe('Design note component', () => {
expect(wrapper.element).toMatchSnapshot();
});
- it('should render an author', () => {
+ it('should render avatar with correct props', () => {
+ createComponent({
+ note,
+ });
+
+ expect(findUserAvatar().props()).toMatchObject({
+ src: note.author.avatarUrl,
+ entityName: note.author.username,
+ });
+
+ expect(findUserAvatarLink().attributes('href')).toBe(note.author.webUrl);
+ });
+
+ it('should render author details', () => {
createComponent({
note,
});
- expect(findUserAvatar().exists()).toBe(true);
expect(findUserLink().exists()).toBe(true);
});