提交 2c635bfc 编写于 作者: P 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
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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册