summaryrefslogtreecommitdiff
path: root/spec/javascripts/repo/components/repo_preview_spec.js
blob: 4920cf0208374558698d9adae00ca600b0760887 (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 repoPreview from '~/repo/components/repo_preview.vue';
import RepoStore from '~/repo/stores/repo_store';

describe('RepoPreview', () => {
  function createComponent() {
    const RepoPreview = Vue.extend(repoPreview);

    return new RepoPreview().$mount();
  }

  it('renders a div with the activeFile html', () => {
    const activeFile = {
      html: '<p class="file-content">html</p>',
    };
    RepoStore.activeFile = activeFile;

    const vm = createComponent();

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