Commit 5c0cb34d authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Minor review feedback

parent 78bf43a1
...@@ -63,7 +63,9 @@ export default { ...@@ -63,7 +63,9 @@ export default {
const { name } = this; const { name } = this;
return this.createValueStream({ name }).then(() => { return this.createValueStream({ name }).then(() => {
this.$refs.modal.hide(); this.$refs.modal.hide();
this.$toast.show(sprintf(__("'%{name}' Value Stream created"), { name })); this.$toast.show(sprintf(__("'%{name}' Value Stream created"), { name }), {
position: 'top-center',
});
this.name = ''; this.name = '';
}); });
}, },
...@@ -76,7 +78,7 @@ export default { ...@@ -76,7 +78,7 @@ export default {
</script> </script>
<template> <template>
<gl-form> <gl-form>
<gl-button v-gl-modal-directive="'create-value-stream-modal'">{{ <gl-button v-gl-modal-directive="'create-value-stream-modal'" @click="onHandleInput">{{
__('Create new value stream') __('Create new value stream')
}}</gl-button> }}</gl-button>
<gl-modal <gl-modal
...@@ -97,12 +99,13 @@ export default { ...@@ -97,12 +99,13 @@ export default {
@primary.prevent="onSubmit" @primary.prevent="onSubmit"
> >
<gl-form-group <gl-form-group
label="Name" :label="__('Name')"
label-for="create-value-stream-name" label-for="create-value-stream-name"
:invalid-feedback="invalidFeedback" :invalid-feedback="invalidFeedback"
:state="isValid" :state="isValid"
> >
<gl-form-input <gl-form-input
id="create-value-stream-name"
v-model.trim="name" v-model.trim="name"
name="create-value-stream-name" name="create-value-stream-name"
:placeholder="__('Example: My value stream')" :placeholder="__('Example: My value stream')"
......
...@@ -1010,7 +1010,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -1010,7 +1010,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do
end end
describe 'Create value stream', :js do describe 'Create value stream', :js do
custom_value_stream_name = "Test value stream" let(:custom_value_stream_name) { "Test value stream" }
before do before do
visit analytics_cycle_analytics_path visit analytics_cycle_analytics_path
...@@ -1019,15 +1019,12 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -1019,15 +1019,12 @@ RSpec.describe 'Group Value Stream Analytics', :js do
end end
it 'can create a value stream' do it 'can create a value stream' do
expect(page).to have_text('Create new value stream') page.find_button(_('Create new value stream')).click
modal_button = page.find_button('Create new value stream')
modal_button.click
fill_in 'create-value-stream-name', with: custom_value_stream_name fill_in 'create-value-stream-name', with: custom_value_stream_name
page.find_button('Create value stream').click page.find_button(_('Create value stream')).click
expect(page).to have_text("'#{custom_value_stream_name}' Value Stream created") expect(page).to have_text(_("'%{name}' Value Stream created") % { name: custom_value_stream_name })
end end
end end
end end
...@@ -55,7 +55,7 @@ describe('ValueStreamSelect', () => { ...@@ -55,7 +55,7 @@ describe('ValueStreamSelect', () => {
describe('with valid fields', () => { describe('with valid fields', () => {
const streamName = 'Cool stream'; const streamName = 'Cool stream';
beforeEach(async () => { beforeEach(() => {
wrapper = createComponent({ data: { name: streamName } }); wrapper = createComponent({ data: { name: streamName } });
wrapper.vm.$refs.modal.hide = mockModalHide; wrapper.vm.$refs.modal.hide = mockModalHide;
}); });
...@@ -77,7 +77,9 @@ describe('ValueStreamSelect', () => { ...@@ -77,7 +77,9 @@ describe('ValueStreamSelect', () => {
}); });
it('displays a toast message', () => { it('displays a toast message', () => {
expect(mockToastShow).toHaveBeenCalledWith(`'${streamName}' Value Stream created`); expect(mockToastShow).toHaveBeenCalledWith(`'${streamName}' Value Stream created`, {
position: 'top-center',
});
}); });
it('hides the modal', () => { it('hides the modal', () => {
...@@ -88,7 +90,7 @@ describe('ValueStreamSelect', () => { ...@@ -88,7 +90,7 @@ describe('ValueStreamSelect', () => {
describe('form submission fails', () => { describe('form submission fails', () => {
const createValueStreamMockFail = jest.fn(() => Promise.reject()); const createValueStreamMockFail = jest.fn(() => Promise.reject());
beforeEach(async () => { beforeEach(() => {
wrapper = createComponent({ wrapper = createComponent({
data: { name: streamName }, data: { name: streamName },
methods: { methods: {
......
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