summaryrefslogtreecommitdiff
path: root/spec/frontend/notes/components/discussion_reply_placeholder_spec.js
blob: b7b7ec0886715a03e8900ecf4582e8c2b70de3e4 (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
35
36
import { shallowMount } from '@vue/test-utils';
import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue';

const buttonText = 'Test Button Text';

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

  const findButton = () => wrapper.find({ ref: 'button' });

  beforeEach(() => {
    wrapper = shallowMount(ReplyPlaceholder, {
      propsData: {
        buttonText,
      },
    });
  });

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

  it('emits onClick event on button click', () => {
    findButton().trigger('click');

    return wrapper.vm.$nextTick().then(() => {
      expect(wrapper.emitted()).toEqual({
        onClick: [[]],
      });
    });
  });

  it('should render reply button', () => {
    expect(findButton().text()).toEqual(buttonText);
  });
});