diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-07 22:56:21 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-08 02:37:34 +0300 |
commit | d11fbccc8dda310f6a3530d04f102d6dcf80941c (patch) | |
tree | a309e6fd3882294e97d2b5211ce4998ebdee1046 /spec/javascripts | |
parent | 1558bd1263ffa733f70d9b1268d2010bc0f704b8 (diff) |
Address frontend feedback
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/vue_mr_widget/components/mr_widget_maintainer_edit_spec.js | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/spec/javascripts/vue_mr_widget/components/mr_widget_maintainer_edit_spec.js b/spec/javascripts/vue_mr_widget/components/mr_widget_maintainer_edit_spec.js index 65b3f721281..cee22d5342a 100644 --- a/spec/javascripts/vue_mr_widget/components/mr_widget_maintainer_edit_spec.js +++ b/spec/javascripts/vue_mr_widget/components/mr_widget_maintainer_edit_spec.js @@ -2,22 +2,39 @@ import Vue from 'vue'; import maintainerEditComponent from '~/vue_merge_request_widget/components/mr_widget_maintainer_edit.vue'; import mountComponent from 'spec/helpers/vue_mount_component_helper'; -describe('MRWidgetAuthor', () => { +describe('RWidgetMaintainerEdit', () => { + let Component; let vm; beforeEach(() => { - const Component = Vue.extend(maintainerEditComponent); - - vm = mountComponent(Component, { - maintainerEditAllowed: true, - }); + Component = Vue.extend(maintainerEditComponent); }); afterEach(() => { vm.$destroy(); }); - it('renders the message when maintainers are allowed to edit', () => { - expect(vm.$el.textContent.trim()).toEqual('Allows edits from maintainers'); + describe('when a maintainer is allowed to edit', () => { + beforeEach(() => { + vm = mountComponent(Component, { + maintainerEditAllowed: true, + }); + }); + + it('it renders the message', () => { + expect(vm.$el.textContent.trim()).toEqual('Allows edits from maintainers'); + }); + }); + + describe('when a maintainer is not allowed to edit', () => { + beforeEach(() => { + vm = mountComponent(Component, { + maintainerEditAllowed: false, + }); + }); + + it('hides the message', () => { + expect(vm.$el.textContent.trim()).toEqual(''); + }); }); }); |