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

37 lines
804 B
JavaScript
Raw Normal View History

2019-03-02 22:35:43 +05:30
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
import { shallowMount, createLocalVue } from '@vue/test-utils';
const localVue = createLocalVue();
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, {
localVue,
2019-09-30 21:07:59 +05:30
propsData: {
buttonText,
},
2019-03-02 22:35:43 +05:30
});
});
afterEach(() => {
wrapper.destroy();
});
it('emits onClick even on button click', () => {
2019-09-30 21:07:59 +05:30
findButton().trigger('click');
2019-03-02 22:35:43 +05:30
expect(wrapper.emitted()).toEqual({
onClick: [[]],
});
});
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
});
});