diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/frontend/sidebar | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/frontend/sidebar')
4 files changed, 23 insertions, 11 deletions
diff --git a/spec/frontend/sidebar/assignees_spec.js b/spec/frontend/sidebar/assignees_spec.js index be27a800418..b3a67f18f82 100644 --- a/spec/frontend/sidebar/assignees_spec.js +++ b/spec/frontend/sidebar/assignees_spec.js @@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils'; import { trimText } from 'helpers/text_helper'; import UsersMockHelper from 'helpers/user_mock_data_helper'; import Assignee from '~/sidebar/components/assignees/assignees.vue'; +import AssigneeAvatarLink from '~/sidebar/components/assignees/assignee_avatar_link.vue'; import UsersMock from './mock_data'; describe('Assignee component', () => { @@ -19,6 +20,7 @@ describe('Assignee component', () => { }); }; + const findAllAvatarLinks = () => wrapper.findAllComponents(AssigneeAvatarLink); const findComponentTextNoUsers = () => wrapper.find('[data-testid="no-value"]'); const findCollapsedChildren = () => wrapper.findAll('.sidebar-collapsed-icon > *'); @@ -148,7 +150,7 @@ describe('Assignee component', () => { editable: true, }); - expect(wrapper.findAll('.user-item').length).toBe(users.length); + expect(findAllAvatarLinks()).toHaveLength(users.length); expect(wrapper.find('.user-list-more').exists()).toBe(false); }); @@ -178,9 +180,9 @@ describe('Assignee component', () => { users, }); - const userItems = wrapper.findAll('.user-list .user-item a'); + const userItems = findAllAvatarLinks(); - expect(userItems.length).toBe(3); + expect(userItems).toHaveLength(3); expect(userItems.at(0).attributes('title')).toBe(users[2].name); }); diff --git a/spec/frontend/sidebar/components/reviewers/uncollapsed_reviewer_list_spec.js b/spec/frontend/sidebar/components/reviewers/uncollapsed_reviewer_list_spec.js index 9f6878db785..6b80224083a 100644 --- a/spec/frontend/sidebar/components/reviewers/uncollapsed_reviewer_list_spec.js +++ b/spec/frontend/sidebar/components/reviewers/uncollapsed_reviewer_list_spec.js @@ -26,9 +26,9 @@ describe('UncollapsedReviewerList component', () => { }); describe('single reviewer', () => { - beforeEach(() => { - const user = userDataMock(); + const user = userDataMock(); + beforeEach(() => { createComponent({ users: [user], }); @@ -39,6 +39,7 @@ describe('UncollapsedReviewerList component', () => { }); it('shows one user with avatar, username and author name', () => { + expect(wrapper.text()).toContain(user.name); expect(wrapper.text()).toContain(`@root`); }); @@ -56,11 +57,18 @@ describe('UncollapsedReviewerList component', () => { }); describe('multiple reviewers', () => { - beforeEach(() => { - const user = userDataMock(); + const user = userDataMock(); + const user2 = { + ...user, + id: 2, + name: 'nonrooty-nonrootersen', + username: 'hello-world', + approved: true, + }; + beforeEach(() => { createComponent({ - users: [user, { ...user, id: 2, username: 'hello-world', approved: true }], + users: [user, user2], }); }); @@ -69,7 +77,9 @@ describe('UncollapsedReviewerList component', () => { }); it('shows both users with avatar, username and author name', () => { + expect(wrapper.text()).toContain(user.name); expect(wrapper.text()).toContain(`@root`); + expect(wrapper.text()).toContain(user2.name); expect(wrapper.text()).toContain(`@hello-world`); }); diff --git a/spec/frontend/sidebar/sidebar_labels_spec.js b/spec/frontend/sidebar/sidebar_labels_spec.js index 7455f684380..8437ee1b723 100644 --- a/spec/frontend/sidebar/sidebar_labels_spec.js +++ b/spec/frontend/sidebar/sidebar_labels_spec.js @@ -27,6 +27,7 @@ describe('sidebar labels', () => { labelsManagePath: '/gitlab-org/gitlab-test/-/labels', projectIssuesPath: '/gitlab-org/gitlab-test/-/issues', projectPath: 'gitlab-org/gitlab-test', + fullPath: 'gitlab-org/gitlab-test', }; const $apollo = { @@ -110,10 +111,9 @@ describe('sidebar labels', () => { mutation: updateIssueLabelsMutation, variables: { input: { - addLabelIds: [40], iid: defaultProps.iid, projectPath: defaultProps.projectPath, - removeLabelIds: [26, 55], + labelIds: [toLabelGid(29), toLabelGid(28), toLabelGid(27), toLabelGid(40)], }, }, }; diff --git a/spec/frontend/sidebar/todo_spec.js b/spec/frontend/sidebar/todo_spec.js index ff6da3abad0..6829e688c65 100644 --- a/spec/frontend/sidebar/todo_spec.js +++ b/spec/frontend/sidebar/todo_spec.js @@ -27,7 +27,7 @@ describe('SidebarTodo', () => { it.each` state | classes ${false} | ${['gl-button', 'btn', 'btn-default', 'btn-todo', 'issuable-header-btn', 'float-right']} - ${true} | ${['btn-blank', 'btn-todo', 'sidebar-collapsed-icon', 'dont-change-state']} + ${true} | ${['btn-blank', 'btn-todo', 'sidebar-collapsed-icon', 'js-dont-change-state']} `('returns todo button classes for when `collapsed` prop is `$state`', ({ state, classes }) => { createComponent({ collapsed: state }); expect(wrapper.find('button').classes()).toStrictEqual(classes); |