2019-03-02 22:35:43 +05:30
|
|
|
import { shallowMount, createLocalVue } 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
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|