summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes/components/note_attachment_spec.js
blob: b14a518b62211f7fe431cc9c48293a3a4b31a5f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Vue from 'vue';
import noteAttachment from '~/notes/components/note_attachment.vue';

describe('issue note attachment', () => {
  it('should render properly', () => {
    const props = {
      attachment: {
        filename: 'dk.png',
        image: true,
        url: '/dk.png',
      },
    };

    const Component = Vue.extend(noteAttachment);
    const vm = new Component({
      propsData: props,
    }).$mount();

    expect(vm.$el.classList.contains('note-attachment')).toBeTruthy();
    expect(vm.$el.querySelector('img').src).toContain(props.attachment.url);
    expect(vm.$el.querySelector('a').href).toContain(props.attachment.url);
  });
});