debian-mirror-gitlab/spec/frontend/notes/components/discussion_reply_placeholder_spec.js
2023-05-27 22:25:52 +05:30

35 lines
886 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
const placeholderText = 'Test Button Text';
describe('ReplyPlaceholder', () => {
let wrapper;
const createComponent = ({ options = {} } = {}) => {
wrapper = shallowMount(ReplyPlaceholder, {
propsData: {
placeholderText,
},
...options,
});
};
const findTextarea = () => wrapper.findComponent({ ref: 'textarea' });
it('emits focus event on button click', async () => {
createComponent({ options: { attachTo: document.body } });
await findTextarea().trigger('focus');
expect(wrapper.emitted()).toEqual({
focus: [[]],
});
});
it('should render reply button', () => {
createComponent();
expect(findTextarea().attributes('placeholder')).toEqual(placeholderText);
});
});