summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-19 16:54:54 +0100
committerPhil Hughes <me@iamphill.com>2018-04-19 16:54:54 +0100
commit913c607030a32742fcd6e72cfe0557b329583173 (patch)
tree60c26f1f97e76aef21a589d67708534d016d1614
parent949160e382765bab5569c2d1de0f398d0ce72eb5 (diff)
downloadgitlab-ce-913c607030a32742fcd6e72cfe0557b329583173.tar.gz
added spec to ide_side_bar
-rw-r--r--app/assets/javascripts/ide/components/ide_side_bar.vue20
-rw-r--r--app/assets/javascripts/ide/components/ide_tree.vue3
-rw-r--r--spec/javascripts/ide/components/ide_side_bar_spec.js18
3 files changed, 27 insertions, 14 deletions
diff --git a/app/assets/javascripts/ide/components/ide_side_bar.vue b/app/assets/javascripts/ide/components/ide_side_bar.vue
index c4bfe6f5ee6..21074e933c0 100644
--- a/app/assets/javascripts/ide/components/ide_side_bar.vue
+++ b/app/assets/javascripts/ide/components/ide_side_bar.vue
@@ -1,9 +1,9 @@
<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>
+ <component
+ :is="activityBarComponent"
+ />
</div>
</template>
</div>
diff --git a/app/assets/javascripts/ide/components/ide_tree.vue b/app/assets/javascripts/ide/components/ide_tree.vue
index 705f91ea6aa..ed83bf4109b 100644
--- a/app/assets/javascripts/ide/components/ide_tree.vue
+++ b/app/assets/javascripts/ide/components/ide_tree.vue
@@ -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"
diff --git a/spec/javascripts/ide/components/ide_side_bar_spec.js b/spec/javascripts/ide/components/ide_side_bar_spec.js
index fb393e61d56..6286c82cca0 100644
--- a/spec/javascripts/ide/components/ide_side_bar_spec.js
+++ b/spec/javascripts/ide/components/ide_side_bar_spec.js
@@ -1,6 +1,7 @@
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();
+ });
+ });
+ });
});