Commit 913c6070 authored by Phil Hughes's avatar Phil Hughes

added spec to ide_side_bar

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