2020-01-08 10:08:01 -05:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2019-12-09 07:07:58 -05:00
|
|
|
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
|
2019-02-05 03:56:34 -05:00
|
|
|
|
2019-07-03 04:26:57 -04:00
|
|
|
const buttonText = 'Test Button Text';
|
2019-02-05 03:56:34 -05:00
|
|
|
|
|
|
|
describe('ReplyPlaceholder', () => {
|
|
|
|
let wrapper;
|
|
|
|
|
2019-07-03 04:26:57 -04:00
|
|
|
const findButton = () => wrapper.find({ ref: 'button' });
|
|
|
|
|
2019-02-05 03:56:34 -05:00
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = shallowMount(ReplyPlaceholder, {
|
2019-07-03 04:26:57 -04:00
|
|
|
propsData: {
|
|
|
|
buttonText,
|
|
|
|
},
|
2019-02-05 03:56:34 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('emits onClick even on button click', () => {
|
2019-07-03 04:26:57 -04:00
|
|
|
findButton().trigger('click');
|
2019-02-05 03:56:34 -05:00
|
|
|
|
2020-01-01 01:09:01 -05:00
|
|
|
return wrapper.vm.$nextTick().then(() => {
|
|
|
|
expect(wrapper.emitted()).toEqual({
|
|
|
|
onClick: [[]],
|
|
|
|
});
|
2019-02-05 03:56:34 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render reply button', () => {
|
2019-07-03 04:26:57 -04:00
|
|
|
expect(findButton().text()).toEqual(buttonText);
|
2019-02-05 03:56:34 -05:00
|
|
|
});
|
|
|
|
});
|