BigW Consortium Gitlab

added spec to ide_side_bar

parent 949160e3
<script>
import { mapState, mapGetters } from 'vuex';
import ProjectAvatarImage from '~/vue_shared/components/project_avatar/image.vue';
import icon from '~/vue_shared/components/icon.vue';
import panelResizer from '~/vue_shared/components/panel_resizer.vue';
import skeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue';
import Icon from '~/vue_shared/components/icon.vue';
import PanelResizer from '~/vue_shared/components/panel_resizer.vue';
import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue';
import Identicon from '../../vue_shared/components/identicon.vue';
import IdeTree from './ide_tree.vue';
import ResizablePanel from './resizable_panel.vue';
......@@ -12,9 +12,9 @@ import CommitSection from './repo_commit_section.vue';
export default {
components: {
icon,
panelResizer,
skeletonLoadingContainer,
Icon,
PanelResizer,
SkeletonLoadingContainer,
ResizablePanel,
ActivityBar,
ProjectAvatarImage,
......@@ -87,11 +87,9 @@ export default {
</a>
</div>
<div class="multi-file-commit-panel-inner-scroll">
<keep-alive>
<component
:is="activityBarComponent"
/>
</keep-alive>
</div>
</template>
</div>
......
......@@ -21,10 +21,9 @@ export default {
<template>
<div
v-if="currentTree"
class="ide-file-list"
>
<template v-if="currentTree.loading">
<template v-if="!currentTree || currentTree.loading">
<div
class="multi-file-loading-container"
v-for="n in 3"
......
import Vue from 'vue';
import store from '~/ide/stores';
import ideSidebar from '~/ide/components/ide_side_bar.vue';
import { ActivityBarViews } from '~/ide/stores/state';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from '../helpers';
import { projectData } from '../mock_data';
......@@ -13,7 +14,6 @@ describe('IdeSidebar', () => {
store.state.currentProjectId = 'abcproject';
store.state.projects.abcproject = projectData;
store.state.currentActivityView = null;
vm = createComponentWithStore(Component, store).$mount();
});
......@@ -38,4 +38,20 @@ describe('IdeSidebar', () => {
done();
});
});
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();
});
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment