diff options
author | Phil Hughes <me@iamphill.com> | 2017-11-15 12:00:27 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-11-15 12:00:27 +0300 |
commit | 068f9df2bdf8b758360dbb81a449986b2636bc3b (patch) | |
tree | a60dd4c380535cacfec7f65c784a780c36598b54 /spec | |
parent | 8ee3ea74f58e0b1e463aa8828efae0206904b380 (diff) | |
parent | 81862c2de1b26ab616b9eb27d0dd9b034483804d (diff) |
Merge branch 'ce-backport-39009-fix-approvals-showing-up-in-empty-mr-widget' into 'master'
Remove approvals when in empty MR widget state -- CE backport
See merge request gitlab-org/gitlab-ce!15362
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/vue_mr_widget/mr_widget_options_spec.js | 19 |
1 files changed, 10 insertions, 9 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 8832dd161c7..9e6d0aa472c 100644 --- a/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/javascripts/vue_mr_widget/mr_widget_options_spec.js @@ -3,13 +3,7 @@ import mrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options'; import eventHub from '~/vue_merge_request_widget/event_hub'; import notify from '~/lib/utils/notify'; import mockData from './mock_data'; - -const createComponent = () => { - delete mrWidgetOptions.el; // Prevent component mounting - gl.mrWidgetData = mockData; - const Component = Vue.extend(mrWidgetOptions); - return new Component(); -}; +import mountComponent from '../helpers/vue_mount_component_helper'; const returnPromise = data => new Promise((resolve) => { resolve({ @@ -22,9 +16,16 @@ const returnPromise = data => new Promise((resolve) => { describe('mrWidgetOptions', () => { let vm; + let MrWidgetOptions; beforeEach(() => { - vm = createComponent(); + // Prevent component mounting + delete mrWidgetOptions.el; + + MrWidgetOptions = Vue.extend(mrWidgetOptions); + vm = mountComponent(MrWidgetOptions, { + mrData: { ...mockData }, + }); }); describe('data', () => { @@ -77,7 +78,7 @@ describe('mrWidgetOptions', () => { }); it('should return true if there is relatedLinks in MR', () => { - vm.mr.relatedLinks = {}; + Vue.set(vm.mr, 'relatedLinks', {}); expect(vm.shouldRenderRelatedLinks).toBeTruthy(); }); }); |