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>2020-07-23 21:10:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-23 21:10:06 +0300
commit7ab026e2a20cd76e86929a4102a809542055897f (patch)
tree7b2e662fc3fb96033c82cf0d77f30e4adc14f3eb /spec/frontend/incidents
parent14fb5a922285d71fea67de59164ee4bb81ee3486 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/incidents')
-rw-r--r--spec/frontend/incidents/components/incidents_list_spec.js28
-rw-r--r--spec/frontend/incidents/mocks/incidents.json11
2 files changed, 37 insertions, 2 deletions
diff --git a/spec/frontend/incidents/components/incidents_list_spec.js b/spec/frontend/incidents/components/incidents_list_spec.js
index 05177a761c2..11b2980b7de 100644
--- a/spec/frontend/incidents/components/incidents_list_spec.js
+++ b/spec/frontend/incidents/components/incidents_list_spec.js
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
-import { GlAlert, GlLoadingIcon, GlTable } from '@gitlab/ui';
+import { GlAlert, GlLoadingIcon, GlTable, GlAvatar } from '@gitlab/ui';
import IncidentsList from '~/incidents/components/incidents_list.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { I18N } from '~/incidents/constants';
@@ -13,6 +13,7 @@ describe('Incidents List', () => {
const findAlert = () => wrapper.find(GlAlert);
const findLoader = () => wrapper.find(GlLoadingIcon);
const findTimeAgo = () => wrapper.findAll(TimeAgoTooltip);
+ const findAssingees = () => wrapper.findAll('[data-testid="incident-assignees"]');
function mountComponent({ data = { incidents: [] }, loading = false }) {
wrapper = mount(IncidentsList, {
@@ -31,6 +32,9 @@ describe('Incidents List', () => {
provide: {
projectPath: '/project/path',
},
+ stubs: {
+ GlAvatar: true,
+ },
});
}
@@ -80,5 +84,27 @@ describe('Incidents List', () => {
it('renders a createdAt with timeAgo component per row', () => {
expect(findTimeAgo().length).toBe(mockIncidents.length);
});
+
+ describe('Assignees', () => {
+ it('shows Unassigned when there are no assignees', () => {
+ expect(
+ findAssingees()
+ .at(0)
+ .text(),
+ ).toBe(I18N.unassigned);
+ });
+
+ it('renders an avatar component when there is an assignee', () => {
+ const avatar = findAssingees()
+ .at(1)
+ .find(GlAvatar);
+ const { src, label } = avatar.attributes();
+ const { name, avatarUrl } = mockIncidents[1].assignees.nodes[0];
+
+ expect(avatar.exists()).toBe(true);
+ expect(label).toBe(name);
+ expect(src).toBe(avatarUrl);
+ });
+ });
});
});
diff --git a/spec/frontend/incidents/mocks/incidents.json b/spec/frontend/incidents/mocks/incidents.json
index e3de5d7b929..734aba190ba 100644
--- a/spec/frontend/incidents/mocks/incidents.json
+++ b/spec/frontend/incidents/mocks/incidents.json
@@ -9,7 +9,16 @@
"iid": "14",
"title": "Create issue4",
"createdAt": "2020-05-19T09:26:07Z",
- "assignees": {}
+ "assignees": {
+ "nodes": [
+ {
+ "name": "Benjamin Braun",
+ "username": "kami.hegmann",
+ "avatarUrl": "https://invalid'",
+ "webUrl": "https://invalid"
+ }
+ ]
+ }
},
{
"iid": "13",