summaryrefslogtreecommitdiff
path: root/spec/frontend/reports
diff options
context:
space:
mode:
authorSam Bigelow <sbigelow@gitlab.com>2019-06-03 17:35:39 -0400
committerSam Bigelow <sbigelow@gitlab.com>2019-06-05 17:29:18 -0400
commitc763d98ed76a2a23c05b9816dee3245779313ecf (patch)
tree41302535a23ed5aae40204ec5383b65a378d4c58 /spec/frontend/reports
parente6a88b024fa7f8e1ec5b712744d0e0d118b026e6 (diff)
downloadgitlab-ce-c763d98ed76a2a23c05b9816dee3245779313ecf.tar.gz
Backport of EE Displaying Blocking MRsee-9688-fe-mr-merge-order
This MR is a backport of an EE merge request
Diffstat (limited to 'spec/frontend/reports')
-rw-r--r--spec/frontend/reports/components/report_section_spec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/frontend/reports/components/report_section_spec.js b/spec/frontend/reports/components/report_section_spec.js
index 3b609484b9e..d4a3073374a 100644
--- a/spec/frontend/reports/components/report_section_spec.js
+++ b/spec/frontend/reports/components/report_section_spec.js
@@ -197,4 +197,44 @@ describe('Report section', () => {
expect(vm.$el.querySelector('.js-collapse-btn').textContent.trim()).toEqual('Expand');
});
});
+
+ describe('Success and Error slots', () => {
+ const createComponent = status => {
+ vm = mountComponentWithSlots(ReportSection, {
+ props: {
+ status,
+ hasIssues: true,
+ },
+ slots: {
+ success: ['This is a success'],
+ loading: ['This is loading'],
+ error: ['This is an error'],
+ },
+ });
+ };
+
+ it('only renders success slot when status is "SUCCESS"', () => {
+ createComponent('SUCCESS');
+
+ expect(vm.$el.textContent.trim()).toContain('This is a success');
+ expect(vm.$el.textContent.trim()).not.toContain('This is an error');
+ expect(vm.$el.textContent.trim()).not.toContain('This is loading');
+ });
+
+ it('only renders error slot when status is "ERROR"', () => {
+ createComponent('ERROR');
+
+ expect(vm.$el.textContent.trim()).toContain('This is an error');
+ expect(vm.$el.textContent.trim()).not.toContain('This is a success');
+ expect(vm.$el.textContent.trim()).not.toContain('This is loading');
+ });
+
+ it('only renders loading slot when status is "LOADING"', () => {
+ createComponent('LOADING');
+
+ expect(vm.$el.textContent.trim()).toContain('This is loading');
+ expect(vm.$el.textContent.trim()).not.toContain('This is an error');
+ expect(vm.$el.textContent.trim()).not.toContain('This is a success');
+ });
+ });
});