diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2019-06-07 17:16:29 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2019-06-07 17:16:29 +0300 |
commit | 53da0237fae80c3e2b1b7d55d150a87d83f1c6e7 (patch) | |
tree | 871e6b45c5c42565bff8e47f7e946a7f676de472 /spec/frontend | |
parent | 5e05ec3b8b7e8f693e3ca74fe73aca64655356a0 (diff) | |
parent | c763d98ed76a2a23c05b9816dee3245779313ecf (diff) |
Merge branch 'ee-9688-fe-mr-merge-order' into 'master'
Backport of EE Displaying Blocking MRs
See merge request gitlab-org/gitlab-ce!29095
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/reports/components/report_section_spec.js | 40 |
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'); + }); + }); }); |