Skip to content
代码片段 群组 项目
提交 6ea62ffd 编辑于 作者: Ezekiel Kigbo's avatar Ezekiel Kigbo
浏览文件

Merge branch '413321-action-button-spec' into 'master'

No related branches found
No related tags found
无相关合并请求
import { GlButton, GlTooltip } from '@gitlab/ui';
import { createWrapper } from '@vue/test-utils';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ActionButton from 'ee/on_demand_scans/components/action_button.vue';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
describe('ActionButton', () => {
let wrapper;
......@@ -42,10 +44,11 @@ describe('ActionButton', () => {
it('emits bv::hide::tooltip and click events on click', () => {
createComponent();
jest.spyOn(wrapper.vm.$root, '$emit');
const rootWrapper = createWrapper(wrapper.vm.$root);
findButton().vm.$emit('click');
expect(wrapper.vm.$root.$emit).toHaveBeenCalledWith('bv::hide::tooltip', expect.any(String));
expect(rootWrapper.emitted(BV_HIDE_TOOLTIP)[0]).toContainEqual(expect.any(String));
expect(wrapper.emitted('click')).toHaveLength(1);
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册