diff options
author | Kushal Pandya <kushalspandya@gmail.com> | 2018-12-28 09:34:18 +0000 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2018-12-28 09:34:18 +0000 |
commit | b623c9185678a7b79418f28c57dd457cbe2fbdea (patch) | |
tree | 1ae288e4b4dba93e8ff71d5360e8628069d7b8af /spec | |
parent | bd268a1e0924ce912ef8bf13373820640b5b53c0 (diff) | |
parent | 485b5beb2f74f56f90f168e68404524a21ac0b2d (diff) | |
download | gitlab-ce-b623c9185678a7b79418f28c57dd457cbe2fbdea.tar.gz |
Merge branch 'allow_collaboration_status_work' into 'master'
Update condition to visibility collaboration status text, #44642.
Closes #44642
See merge request gitlab-org/gitlab-ce!23104
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_mr_widget/mr_widget_options_spec.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js index f72bf627c10..99b80df766a 100644 --- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js @@ -18,6 +18,8 @@ describe('mrWidgetOptions', () => { let vm; let MrWidgetOptions; + const COLLABORATION_MESSAGE = 'Allows commits from members who can merge to the target branch'; + beforeEach(() => { // Prevent component mounting delete mrWidgetOptions.el; @@ -132,6 +134,53 @@ describe('mrWidgetOptions', () => { expect(vm.shouldRenderSourceBranchRemovalStatus).toEqual(false); }); }); + + describe('shouldRenderCollaborationStatus', () => { + describe('when collaboration is allowed', () => { + beforeEach(() => { + vm.mr.allowCollaboration = true; + }); + + describe('when merge request is opened', () => { + beforeEach(done => { + vm.mr.isOpen = true; + vm.$nextTick(done); + }); + + it('should render collaboration status', () => { + expect(vm.$el.textContent).toContain(COLLABORATION_MESSAGE); + }); + }); + + describe('when merge request is not opened', () => { + beforeEach(done => { + vm.mr.isOpen = false; + vm.$nextTick(done); + }); + + it('should not render collaboration status', () => { + expect(vm.$el.textContent).not.toContain(COLLABORATION_MESSAGE); + }); + }); + }); + + describe('when collaboration is not allowed', () => { + beforeEach(() => { + vm.mr.allowCollaboration = false; + }); + + describe('when merge request is opened', () => { + beforeEach(done => { + vm.mr.isOpen = true; + vm.$nextTick(done); + }); + + it('should not render collaboration status', () => { + expect(vm.$el.textContent).not.toContain(COLLABORATION_MESSAGE); + }); + }); + }); + }); }); describe('methods', () => { |