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

37 lines
837 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
2021-04-17 20:07:23 +05:30
const placeholderText = 'Test Button Text';
2019-03-02 22:35:43 +05:30
describe('ReplyPlaceholder', () => {
let wrapper;
2021-04-17 20:07:23 +05:30
const findTextarea = () => wrapper.find({ ref: 'textarea' });
2019-09-30 21:07:59 +05:30
2019-03-02 22:35:43 +05:30
beforeEach(() => {
wrapper = shallowMount(ReplyPlaceholder, {
2019-09-30 21:07:59 +05:30
propsData: {
2021-04-17 20:07:23 +05:30
placeholderText,
2019-09-30 21:07:59 +05:30
},
2019-03-02 22:35:43 +05:30
});
});
afterEach(() => {
wrapper.destroy();
});
2021-04-17 20:07:23 +05:30
it('emits focus event on button click', () => {
findTextarea().trigger('focus');
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({
2021-04-17 20:07:23 +05:30
focus: [[]],
2020-03-13 15:44:24 +05:30
});
2019-03-02 22:35:43 +05:30
});
});
it('should render reply button', () => {
2021-04-17 20:07:23 +05:30
expect(findTextarea().attributes('placeholder')).toEqual(placeholderText);
2019-03-02 22:35:43 +05:30
});
});