summaryrefslogtreecommitdiff
path: root/spec/frontend/incidents
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-18 13:16:36 +0000
commit311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch)
tree07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/frontend/incidents
parent27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff)
downloadgitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/frontend/incidents')
-rw-r--r--spec/frontend/incidents/components/incidents_list_spec.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/spec/frontend/incidents/components/incidents_list_spec.js b/spec/frontend/incidents/components/incidents_list_spec.js
index 8d4ccab2a40..48545ffd2d6 100644
--- a/spec/frontend/incidents/components/incidents_list_spec.js
+++ b/spec/frontend/incidents/components/incidents_list_spec.js
@@ -78,6 +78,7 @@ describe('Incidents List', () => {
authorUsernameQuery: '',
assigneeUsernameQuery: '',
slaFeatureAvailable: true,
+ canCreateIncident: true,
...provide,
},
stubs: {
@@ -105,21 +106,23 @@ describe('Incidents List', () => {
describe('empty state', () => {
const {
- emptyState: { title, emptyClosedTabTitle, description },
+ emptyState: { title, emptyClosedTabTitle, description, cannotCreateIncidentDescription },
} = I18N;
it.each`
- statusFilter | all | closed | expectedTitle | expectedDescription
- ${'all'} | ${2} | ${1} | ${title} | ${description}
- ${'open'} | ${2} | ${0} | ${title} | ${description}
- ${'closed'} | ${0} | ${0} | ${title} | ${description}
- ${'closed'} | ${2} | ${0} | ${emptyClosedTabTitle} | ${undefined}
+ statusFilter | all | closed | expectedTitle | canCreateIncident | expectedDescription
+ ${'all'} | ${2} | ${1} | ${title} | ${true} | ${description}
+ ${'open'} | ${2} | ${0} | ${title} | ${true} | ${description}
+ ${'closed'} | ${0} | ${0} | ${title} | ${true} | ${description}
+ ${'closed'} | ${2} | ${0} | ${emptyClosedTabTitle} | ${true} | ${undefined}
+ ${'all'} | ${2} | ${1} | ${title} | ${false} | ${cannotCreateIncidentDescription}
`(
`when active tab is $statusFilter and there are $all incidents in total and $closed closed incidents, the empty state
has title: $expectedTitle and description: $expectedDescription`,
- ({ statusFilter, all, closed, expectedTitle, expectedDescription }) => {
+ ({ statusFilter, all, closed, expectedTitle, expectedDescription, canCreateIncident }) => {
mountComponent({
data: { incidents: { list: [] }, incidentsCount: { all, closed }, statusFilter },
+ provide: { canCreateIncident },
loading: false,
});
expect(findEmptyState().exists()).toBe(true);
@@ -219,6 +222,15 @@ describe('Incidents List', () => {
expect(findCreateIncidentBtn().exists()).toBe(false);
});
+ it("doesn't show the button when user does not have incident creation permissions", () => {
+ mountComponent({
+ data: { incidents: { list: mockIncidents }, incidentsCount: {} },
+ provide: { canCreateIncident: false },
+ loading: false,
+ });
+ expect(findCreateIncidentBtn().exists()).toBe(false);
+ });
+
it('should track create new incident button', async () => {
findCreateIncidentBtn().vm.$emit('click');
await wrapper.vm.$nextTick();