2018-05-09 12:01:36 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import repoTabs from '~/ide/components/repo_tabs.vue';
|
|
|
|
import createComponent from '../../helpers/vue_mount_component_helper';
|
|
|
|
import { file } from '../helpers';
|
|
|
|
|
|
|
|
describe('RepoTabs', () => {
|
|
|
|
const openedFiles = [file('open1'), file('open2')];
|
|
|
|
const RepoTabs = Vue.extend(repoTabs);
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a list of tabs', done => {
|
|
|
|
vm = createComponent(RepoTabs, {
|
|
|
|
files: openedFiles,
|
|
|
|
viewer: 'editor',
|
|
|
|
activeFile: file('activeFile'),
|
|
|
|
});
|
|
|
|
openedFiles[0].active = true;
|
|
|
|
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
const tabs = [...vm.$el.querySelectorAll('.multi-file-tab')];
|
|
|
|
|
|
|
|
expect(tabs.length).toEqual(2);
|
2018-10-15 14:42:47 +05:30
|
|
|
expect(tabs[0].parentNode.classList.contains('active')).toEqual(true);
|
|
|
|
expect(tabs[1].parentNode.classList.contains('active')).toEqual(false);
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|