summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_shared/components/markdown/toolbar_spec.js
blob: e7c31014bfc490c81445ac1c174f33ecc69a2f5c (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
import Vue from 'vue';
import mountComponent from 'helpers/vue_mount_component_helper';
import toolbar from '~/vue_shared/components/markdown/toolbar.vue';

describe('toolbar', () => {
  let vm;
  const Toolbar = Vue.extend(toolbar);
  const props = {
    markdownDocsPath: '',
  };

  afterEach(() => {
    vm.$destroy();
  });

  describe('user can attach file', () => {
    beforeEach(() => {
      vm = mountComponent(Toolbar, props);
    });

    it('should render uploading-container', () => {
      expect(vm.$el.querySelector('.uploading-container')).not.toBeNull();
    });
  });

  describe('user cannot attach file', () => {
    beforeEach(() => {
      vm = mountComponent(Toolbar, { ...props, canAttachFile: false });
    });

    it('should not render uploading-container', () => {
      expect(vm.$el.querySelector('.uploading-container')).toBeNull();
    });
  });
});