diff options
Diffstat (limited to 'spec/javascripts/ide/components/commit_sidebar/actions_spec.js')
-rw-r--r-- | spec/javascripts/ide/components/commit_sidebar/actions_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/javascripts/ide/components/commit_sidebar/actions_spec.js b/spec/javascripts/ide/components/commit_sidebar/actions_spec.js index 144e78d14b5..27f10caccb1 100644 --- a/spec/javascripts/ide/components/commit_sidebar/actions_spec.js +++ b/spec/javascripts/ide/components/commit_sidebar/actions_spec.js @@ -3,6 +3,7 @@ import store from '~/ide/stores'; import commitActions from '~/ide/components/commit_sidebar/actions.vue'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { resetStore } from 'spec/ide/helpers'; +import { projectData } from 'spec/ide/mock_data'; describe('IDE commit sidebar actions', () => { let vm; @@ -13,6 +14,8 @@ describe('IDE commit sidebar actions', () => { vm = createComponentWithStore(Component, store); vm.$store.state.currentBranchId = 'master'; + vm.$store.state.currentProjectId = 'abcproject'; + Vue.set(vm.$store.state.projects, 'abcproject', { ...projectData }); vm.$mount(); @@ -32,4 +35,15 @@ describe('IDE commit sidebar actions', () => { it('renders current branch text', () => { expect(vm.$el.textContent).toContain('Commit to master branch'); }); + + it('hides merge request option when project merge requests are disabled', done => { + vm.$store.state.projects.abcproject.merge_requests_enabled = false; + + vm.$nextTick(() => { + expect(vm.$el.querySelectorAll('input[type="radio"]').length).toBe(2); + expect(vm.$el.textContent).not.toContain('Create a new branch and merge request'); + + done(); + }); + }); }); |