summaryrefslogtreecommitdiff
path: root/spec/frontend/notes/components/discussion_reply_placeholder_spec.js
blob: 07a366cf33988315e13927abb7303f07dcfdc0d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';
import { shallowMount, createLocalVue } from '@vue/test-utils';

const localVue = createLocalVue();

describe('ReplyPlaceholder', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = shallowMount(ReplyPlaceholder, {
      localVue,
    });
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it('emits onClick even on button click', () => {
    const button = wrapper.find({ ref: 'button' });

    button.trigger('click');

    expect(wrapper.emitted()).toEqual({
      onClick: [[]],
    });
  });

  it('should render reply button', () => {
    const button = wrapper.find({ ref: 'button' });

    expect(button.text()).toEqual('Reply...');
  });
});