Commit 2c7b3384 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Added specs for displaying the button

Ensures the create new value stream
button is available when the feature
flag is on

Update gitlab pot file
parent 186e8c43
......@@ -113,7 +113,7 @@ export default {
// https://gitlab.com/gitlab-org/gitlab/-/issues/223735
return this.featureFlags.hasFilterBar && this.currentGroupPath;
},
canCreateMultipleValueStreams() {
shouldDisplayCreateMultipleValueStreams() {
return Boolean(this.featureFlags.hasCreateMultipleValueStreams);
},
isLoadingTypeOfWork() {
......@@ -220,17 +220,20 @@ export default {
<template>
<div>
<div
class="mb-3 gl-display-flex gl-flex-direction-column gl-sm-flex-direction-row gl-justify-content-space-between"
class="gl-mb-3 gl-display-flex gl-flex-direction-column gl-sm-flex-direction-row gl-justify-content-space-between"
>
<h3>{{ __('Value Stream Analytics') }}</h3>
<div
v-if="shouldDisplayCreateMultipleValueStreams"
class="gl-align-self-center"
:class="{
'gl-w-full': isXSBreakpoint,
'gl-mt-5': !isXSBreakpoint,
}"
>
<gl-button @click="onCreateValueStream">{{ __('Create new value stream') }}</gl-button>
<gl-button data-testid="create-value-stream" @click="onCreateValueStream">{{
__('Create new value stream')
}}</gl-button>
</div>
</div>
<div class="mw-100">
......
......@@ -48,4 +48,16 @@ RSpec.describe 'Group value stream analytics' do
expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsFilterBar: false)
end
end
context 'when `value_stream_analytics_create_multiple_value_streams` is disabled for a group' do
before do
stub_feature_flags(value_stream_analytics_create_multiple_value_streams: false, thing: group)
end
it 'pushes disabled feature flag to the frontend' do
visit group_analytics_cycle_analytics_path(group)
expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsCreateMultipleValueStreams: false)
end
end
end
......@@ -51,6 +51,7 @@ const defaultFeatureFlags = {
hasDurationChartMedian: true,
hasPathNavigation: false,
hasFilterBar: false,
hasCreateMultipleValueStreams: false,
};
const initialCycleAnalyticsState = {
......@@ -169,6 +170,10 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(FilterBar).exists()).toBe(flag);
};
const displaysCreateValueStream = flag => {
expect(wrapper.find('[data-testid="create-value-stream"]').exists()).toBe(flag);
};
beforeEach(() => {
mock = new MockAdapter(axios);
wrapper = createComponent({
......@@ -232,6 +237,9 @@ describe('Cycle Analytics component', () => {
it('does not display the path navigation', () => {
displaysPathNavigation(false);
});
it('does not display the create multiple value streams button', () => {
displaysCreateValueStream(false);
});
describe('hideGroupDropDown = true', () => {
beforeEach(() => {
......@@ -247,6 +255,21 @@ describe('Cycle Analytics component', () => {
expect(wrapper.find(GroupsDropdownFilter).exists()).toBe(false);
});
});
describe('hasCreateMultipleValueStreams = true', () => {
beforeEach(() => {
mock = new MockAdapter(axios);
wrapper = createComponent({
featureFlags: {
hasCreateMultipleValueStreams: true,
},
});
});
it('displays the create multiple value streams button', () => {
displaysCreateValueStream(true);
});
});
});
describe('after a filter has been selected', () => {
......
......@@ -6833,6 +6833,9 @@ msgstr ""
msgid "Create new label"
msgstr ""
msgid "Create new value stream"
msgstr ""
msgid "Create new..."
msgstr ""
......
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