debian-mirror-gitlab/spec/javascripts/ide/components/ide_side_bar_spec.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import Vue from 'vue';
2020-01-01 13:55:28 +05:30
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
2018-05-09 12:01:36 +05:30
import store from '~/ide/stores';
import ideSidebar from '~/ide/components/ide_side_bar.vue';
2018-10-15 14:42:47 +05:30
import { activityBarViews } from '~/ide/constants';
2018-05-09 12:01:36 +05:30
import { resetStore } from '../helpers';
2018-10-15 14:42:47 +05:30
import { projectData } from '../mock_data';
2018-05-09 12:01:36 +05:30
describe('IdeSidebar', () => {
let vm;
beforeEach(() => {
const Component = Vue.extend(ideSidebar);
2018-10-15 14:42:47 +05:30
store.state.currentProjectId = 'abcproject';
store.state.projects.abcproject = projectData;
2018-05-09 12:01:36 +05:30
vm = createComponentWithStore(Component, store).$mount();
});
afterEach(() => {
vm.$destroy();
resetStore(vm.$store);
});
it('renders a sidebar', () => {
2018-10-15 14:42:47 +05:30
expect(vm.$el.querySelector('.multi-file-commit-panel-inner')).not.toBeNull();
2018-05-09 12:01:36 +05:30
});
it('renders loading icon component', done => {
vm.$store.state.loading = true;
vm.$nextTick(() => {
2018-10-15 14:42:47 +05:30
expect(vm.$el.querySelector('.multi-file-loading-container')).not.toBeNull();
expect(vm.$el.querySelectorAll('.multi-file-loading-container').length).toBe(3);
2018-05-09 12:01:36 +05:30
done();
});
});
2018-10-15 14:42:47 +05:30
describe('activityBarComponent', () => {
it('renders tree component', () => {
expect(vm.$el.querySelector('.ide-file-list')).not.toBeNull();
});
it('renders commit component', done => {
vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$nextTick(() => {
expect(vm.$el.querySelector('.multi-file-commit-panel-section')).not.toBeNull();
done();
});
});
});
2018-05-09 12:01:36 +05:30
});