Commit 3feab2e3 authored by mgandres's avatar mgandres

Add file nav to pipeline editor empty state

This replaces the branch switcher component in the
empty state with the file nave component, which should be
visible to the user as we add more features to it in the
future.
parent be2d1f2a
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
import { GlButton, GlSprintf } from '@gitlab/ui'; import { GlButton, GlSprintf } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import BranchSwitcher from '../file_nav/branch_switcher.vue'; import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue';
export default { export default {
components: { components: {
BranchSwitcher,
GlButton, GlButton,
GlSprintf, GlSprintf,
PipelineEditorFileNav,
}, },
i18n: { i18n: {
title: __('Optimize your workflow with CI/CD Pipelines'), title: __('Optimize your workflow with CI/CD Pipelines'),
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
}, },
}, },
computed: { computed: {
showBranchSwitcher() { showFileNav() {
return this.glFeatures.pipelineEditorBranchSwitcher; return this.glFeatures.pipelineEditorBranchSwitcher;
}, },
showCTAButton() { showCTAButton() {
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
<template> <template>
<div> <div>
<div class="gl-mb-5"> <div class="gl-mb-5">
<branch-switcher v-if="showBranchSwitcher" v-on="$listeners" /> <pipeline-editor-file-nav v-if="showFileNav" v-on="$listeners" />
</div> </div>
<div class="gl-display-flex gl-flex-direction-column gl-align-items-center gl-mt-11"> <div class="gl-display-flex gl-flex-direction-column gl-align-items-center gl-mt-11">
<img :src="emptyStateIllustrationPath" /> <img :src="emptyStateIllustrationPath" />
......
import { GlButton, GlSprintf } from '@gitlab/ui'; import { GlButton, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import BranchSwitcher from '~/pipeline_editor/components/file_nav/branch_switcher.vue'; import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue';
import PipelineEditorEmptyState from '~/pipeline_editor/components/ui/pipeline_editor_empty_state.vue'; import PipelineEditorEmptyState from '~/pipeline_editor/components/ui/pipeline_editor_empty_state.vue';
describe('Pipeline editor empty state', () => { describe('Pipeline editor empty state', () => {
...@@ -19,7 +19,7 @@ describe('Pipeline editor empty state', () => { ...@@ -19,7 +19,7 @@ describe('Pipeline editor empty state', () => {
}); });
}; };
const findBranchSwitcher = () => wrapper.findComponent(BranchSwitcher); const findFileNav = () => wrapper.findComponent(PipelineEditorFileNav);
const findSvgImage = () => wrapper.find('img'); const findSvgImage = () => wrapper.find('img');
const findTitle = () => wrapper.find('h1'); const findTitle = () => wrapper.find('h1');
const findConfirmButton = () => wrapper.findComponent(GlButton); const findConfirmButton = () => wrapper.findComponent(GlButton);
...@@ -48,8 +48,8 @@ describe('Pipeline editor empty state', () => { ...@@ -48,8 +48,8 @@ describe('Pipeline editor empty state', () => {
expect(findDescription().html()).toContain(wrapper.vm.$options.i18n.body); expect(findDescription().html()).toContain(wrapper.vm.$options.i18n.body);
}); });
it('renders the branch switcher', () => { it('renders the file nav', () => {
expect(findBranchSwitcher().exists()).toBe(true); expect(findFileNav().exists()).toBe(true);
}); });
describe('with feature flag off', () => { describe('with feature flag off', () => {
...@@ -84,14 +84,14 @@ describe('Pipeline editor empty state', () => { ...@@ -84,14 +84,14 @@ describe('Pipeline editor empty state', () => {
}); });
describe('with branch switcher feature flag OFF', () => { describe('with branch switcher feature flag OFF', () => {
it('does not render the branch switcher', () => { it('does not render the file nav', () => {
createComponent({ createComponent({
provide: { provide: {
glFeatures: { pipelineEditorBranchSwitcher: false }, glFeatures: { pipelineEditorBranchSwitcher: false },
}, },
}); });
expect(findBranchSwitcher().exists()).toBe(false); expect(findFileNav().exists()).toBe(false);
}); });
}); });
}); });
......
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