2020-01-08 10:08:01 -05:00
|
|
|
import { shallowMount } from '@vue/test-utils';
|
2020-10-06 14:08:49 -04:00
|
|
|
import { GlButton } from '@gitlab/ui';
|
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;
|
|
|
|
|
2020-10-06 14:08:49 -04:00
|
|
|
const findButton = () => wrapper.find(GlButton);
|
2019-07-03 04:26:57 -04:00
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2020-10-06 14:08:49 -04:00
|
|
|
it('should emit a onClick event on button click', () => {
|
|
|
|
findButton().vm.$emit('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
|
|
|
});
|
|
|
|
});
|