Commit 64aafe2f authored by Coung Ngo's avatar Coung Ngo

Remove ref from ReplyButton component

Clean up some code as a follow-up from a previous MR

https://gitlab.com/gitlab-org/gitlab/-/issues/321379
parent 6549a87a
...@@ -18,7 +18,6 @@ export default { ...@@ -18,7 +18,6 @@ export default {
<template> <template>
<gl-button <gl-button
ref="button"
v-gl-tooltip v-gl-tooltip
data-track-event="click_button" data-track-event="click_button"
data-track-label="reply_comment_button" data-track-label="reply_comment_button"
......
import { createLocalVue, mount } from '@vue/test-utils'; import { GlButton } from '@gitlab/ui';
import Vuex from 'vuex'; import { shallowMount } from '@vue/test-utils';
import ReplyButton from '~/notes/components/note_actions/reply_button.vue'; import ReplyButton from '~/notes/components/note_actions/reply_button.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('ReplyButton', () => { describe('ReplyButton', () => {
let wrapper; let wrapper;
beforeEach(() => { beforeEach(() => {
wrapper = mount(localVue.extend(ReplyButton), { wrapper = shallowMount(ReplyButton);
localVue,
});
}); });
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}); });
it('emits startReplying on click', () => { it('emits startReplying on click', () => {
const button = wrapper.find({ ref: 'button' }); wrapper.find(GlButton).vm.$emit('click');
button.trigger('click');
expect(wrapper.emitted().startReplying).toBeTruthy(); expect(wrapper.emitted('startReplying')).toEqual([[]]);
expect(wrapper.emitted().startReplying.length).toBe(1);
}); });
}); });
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