2018-03-20 10:12:48 -04:00
|
|
|
import Vue from 'vue';
|
2020-04-28 17:09:35 -04:00
|
|
|
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
|
2018-03-20 10:16:38 -04:00
|
|
|
import store from '~/ide/stores';
|
|
|
|
import ideSidebar from '~/ide/components/ide_side_bar.vue';
|
2020-02-18 01:09:06 -05:00
|
|
|
import { leftSidebarViews } from '~/ide/constants';
|
2018-03-20 10:12:48 -04:00
|
|
|
import { resetStore } from '../helpers';
|
2018-04-17 11:27:46 -04:00
|
|
|
import { projectData } from '../mock_data';
|
2018-03-20 10:12:48 -04:00
|
|
|
|
|
|
|
describe('IdeSidebar', () => {
|
|
|
|
let vm;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const Component = Vue.extend(ideSidebar);
|
|
|
|
|
2018-04-17 11:27:46 -04:00
|
|
|
store.state.currentProjectId = 'abcproject';
|
|
|
|
store.state.projects.abcproject = projectData;
|
|
|
|
|
2018-03-20 10:12:48 -04:00
|
|
|
vm = createComponentWithStore(Component, store).$mount();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
vm.$destroy();
|
|
|
|
|
|
|
|
resetStore(vm.$store);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders a sidebar', () => {
|
2018-04-17 11:27:46 -04:00
|
|
|
expect(vm.$el.querySelector('.multi-file-commit-panel-inner')).not.toBeNull();
|
2018-03-20 10:12:48 -04:00
|
|
|
});
|
|
|
|
|
2018-03-20 10:16:38 -04:00
|
|
|
it('renders loading icon component', done => {
|
2018-03-20 10:12:48 -04:00
|
|
|
vm.$store.state.loading = true;
|
|
|
|
|
|
|
|
vm.$nextTick(() => {
|
2018-04-17 11:27:46 -04:00
|
|
|
expect(vm.$el.querySelector('.multi-file-loading-container')).not.toBeNull();
|
|
|
|
expect(vm.$el.querySelectorAll('.multi-file-loading-container').length).toBe(3);
|
2018-03-20 10:12:48 -04:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2018-04-19 11:54:54 -04:00
|
|
|
|
|
|
|
describe('activityBarComponent', () => {
|
|
|
|
it('renders tree component', () => {
|
|
|
|
expect(vm.$el.querySelector('.ide-file-list')).not.toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders commit component', done => {
|
2020-02-18 01:09:06 -05:00
|
|
|
vm.$store.state.currentActivityView = leftSidebarViews.commit.name;
|
2018-04-19 11:54:54 -04:00
|
|
|
|
|
|
|
vm.$nextTick(() => {
|
|
|
|
expect(vm.$el.querySelector('.multi-file-commit-panel-section')).not.toBeNull();
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2018-03-20 10:12:48 -04:00
|
|
|
});
|