Commit c27afc3e authored by Illya Klymov's avatar Illya Klymov Committed by Clement Ho

Add missing flash import

parent ff7c8d34
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { __ } from '~/locale';
import createFlash from '~/flash';
import statusIcon from '../mr_widget_status_icon.vue'; import statusIcon from '../mr_widget_status_icon.vue';
import tooltip from '../../../vue_shared/directives/tooltip'; import tooltip from '../../../vue_shared/directives/tooltip';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
...@@ -29,12 +31,12 @@ export default { ...@@ -29,12 +31,12 @@ export default {
.then(res => res.data) .then(res => res.data)
.then(data => { .then(data => {
eventHub.$emit('UpdateWidgetData', data); eventHub.$emit('UpdateWidgetData', data);
new window.Flash('The merge request can now be merged.', 'notice'); // eslint-disable-line createFlash(__('The merge request can now be merged.'), 'notice');
$('.merge-request .detail-page-description .title').text(this.mr.title); $('.merge-request .detail-page-description .title').text(this.mr.title);
}) })
.catch(() => { .catch(() => {
this.isMakingRequest = false; this.isMakingRequest = false;
new window.Flash('Something went wrong. Please try again.'); // eslint-disable-line createFlash(__('Something went wrong. Please try again.'));
}); });
}, },
}, },
......
...@@ -15527,6 +15527,9 @@ msgstr "" ...@@ -15527,6 +15527,9 @@ msgstr ""
msgid "The merge conflicts for this merge request have already been resolved. Please return to the merge request." msgid "The merge conflicts for this merge request have already been resolved. Please return to the merge request."
msgstr "" msgstr ""
msgid "The merge request can now be merged."
msgstr ""
msgid "The name %{entryName} is already taken in this directory." msgid "The name %{entryName} is already taken in this directory."
msgstr "" msgstr ""
......
...@@ -47,7 +47,7 @@ describe('Wip', () => { ...@@ -47,7 +47,7 @@ describe('Wip', () => {
it('should make a request to service and handle response', done => { it('should make a request to service and handle response', done => {
const vm = createComponent(); const vm = createComponent();
spyOn(window, 'Flash').and.returnValue(true); const flashSpy = spyOnDependency(WorkInProgress, 'createFlash').and.returnValue(true);
spyOn(eventHub, '$emit'); spyOn(eventHub, '$emit');
spyOn(vm.service, 'removeWIP').and.returnValue( spyOn(vm.service, 'removeWIP').and.returnValue(
new Promise(resolve => { new Promise(resolve => {
...@@ -61,10 +61,7 @@ describe('Wip', () => { ...@@ -61,10 +61,7 @@ describe('Wip', () => {
setTimeout(() => { setTimeout(() => {
expect(vm.isMakingRequest).toBeTruthy(); expect(vm.isMakingRequest).toBeTruthy();
expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj); expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj);
expect(window.Flash).toHaveBeenCalledWith( expect(flashSpy).toHaveBeenCalledWith('The merge request can now be merged.', 'notice');
'The merge request can now be merged.',
'notice',
);
done(); done();
}, 333); }, 333);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment