Commit 2c635bfc authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'edit-delete-vuln-dismissal-toast-notication-vue-global' into 'master'

Backport global toast notification changes

See merge request gitlab-org/gitlab-ce!32810
parents 95d16dc0 250660ca
import Vue from 'vue';
import { GlToast } from '@gitlab/ui';
Vue.use(GlToast);
export default function showGlobalToast(...args) {
return Vue.toasted.show(...args);
}
import toast from '~/vue_shared/plugins/global_toast';
import Vue from 'vue';
describe('Global toast', () => {
let spyFunc;
beforeEach(() => {
spyFunc = jest.spyOn(Vue.toasted, 'show').mockImplementation(() => {});
});
afterEach(() => {
spyFunc.mockRestore();
});
it('should pass all args to Vue toasted', () => {
const arg1 = 'TestMessage';
const arg2 = { className: 'foo' };
toast(arg1, arg2);
expect(Vue.toasted.show).toHaveBeenCalledTimes(1);
expect(Vue.toasted.show).toHaveBeenCalledWith(arg1, arg2);
});
});
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