debian-mirror-gitlab/spec/javascripts/repo/components/repo_preview_spec.js

38 lines
744 B
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
import Vue from 'vue';
2018-03-17 18:26:18 +05:30
import store from '~/ide/stores';
import repoPreview from '~/ide/components/repo_preview.vue';
import { file, resetStore } from '../helpers';
2017-09-10 17:25:29 +05:30
describe('RepoPreview', () => {
2018-03-17 18:26:18 +05:30
let vm;
2017-09-10 17:25:29 +05:30
function createComponent() {
2018-03-17 18:26:18 +05:30
const f = file();
2017-09-10 17:25:29 +05:30
const RepoPreview = Vue.extend(repoPreview);
2018-03-17 18:26:18 +05:30
const comp = new RepoPreview({
store,
});
f.active = true;
f.html = 'test';
comp.$store.state.openFiles.push(f);
return comp.$mount();
2017-09-10 17:25:29 +05:30
}
2018-03-17 18:26:18 +05:30
afterEach(() => {
vm.$destroy();
resetStore(vm.$store);
});
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
it('renders a div with the activeFile html', () => {
vm = createComponent();
2017-09-10 17:25:29 +05:30
expect(vm.$el.tagName).toEqual('DIV');
2018-03-17 18:26:18 +05:30
expect(vm.$el.innerHTML).toContain('test');
2017-09-10 17:25:29 +05:30
});
});