debian-mirror-gitlab/spec/frontend/notes/components/discussion_reply_placeholder_spec.js

37 lines
799 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import { shallowMount } from '@vue/test-utils';
2020-01-01 13:55:28 +05:30
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
2019-03-02 22:35:43 +05:30
2019-09-30 21:07:59 +05:30
const buttonText = 'Test Button Text';
2019-03-02 22:35:43 +05:30
describe('ReplyPlaceholder', () => {
let wrapper;
2019-09-30 21:07:59 +05:30
const findButton = () => wrapper.find({ ref: 'button' });
2019-03-02 22:35:43 +05:30
beforeEach(() => {
wrapper = shallowMount(ReplyPlaceholder, {
2019-09-30 21:07:59 +05:30
propsData: {
buttonText,
},
2019-03-02 22:35:43 +05:30
});
});
afterEach(() => {
wrapper.destroy();
});
2020-06-23 00:09:42 +05:30
it('emits onClick event on button click', () => {
2019-09-30 21:07:59 +05:30
findButton().trigger('click');
2019-03-02 22:35:43 +05:30
2020-03-13 15:44:24 +05:30
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted()).toEqual({
onClick: [[]],
});
2019-03-02 22:35:43 +05:30
});
});
it('should render reply button', () => {
2019-09-30 21:07:59 +05:30
expect(findButton().text()).toEqual(buttonText);
2019-03-02 22:35:43 +05:30
});
});