summaryrefslogtreecommitdiff
path: root/spec/javascripts/repo/components/repo_preview_spec.js
blob: 8d1a87494cfb470c9e4fec221d40e7cbe12fc90e (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
37
import Vue from 'vue';
import store from '~/repo/stores';
import repoPreview from '~/repo/components/repo_preview.vue';
import { file, resetStore } from '../helpers';

describe('RepoPreview', () => {
  let vm;

  function createComponent() {
    const f = file();
    const RepoPreview = Vue.extend(repoPreview);

    const comp = new RepoPreview({
      store,
    });

    f.active = true;
    f.html = 'test';

    comp.$store.state.openFiles.push(f);

    return comp.$mount();
  }

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

    resetStore(vm.$store);
  });

  it('renders a div with the activeFile html', () => {
    vm = createComponent();

    expect(vm.$el.tagName).toEqual('DIV');
    expect(vm.$el.innerHTML).toContain('test');
  });
});