Commit 21fc1b56 authored by Jose Vargas's avatar Jose Vargas

Change merge train position messaging

This changes the merge train mr widget
message content and related tests
parent 650f3ad4
...@@ -11,9 +11,19 @@ export default { ...@@ -11,9 +11,19 @@ export default {
}, },
computed: { computed: {
message() { message() {
return sprintf(s__('mrWidget|In the merge train at position %{mergeTrainPosition}'), { const messageBeginningTrainPosition = s__(
mergeTrainPosition: this.mergeTrainIndex + 1, 'mrWidget|A new merge train has started and this merge request is the first of the queue.',
}); );
const messageAddedTrainPosition = sprintf(
s__(
'mrWidget|Added to the merge train. There are %{mergeTrainPosition} merge requests waiting to be merged',
),
{
mergeTrainPosition: this.mergeTrainIndex + 1,
},
);
return this.mergeTrainIndex === 0 ? messageBeginningTrainPosition : messageAddedTrainPosition;
}, },
}, },
}; };
......
---
title: Change merge train position messaging
merge_request: 40777
author:
type: changed
...@@ -4,14 +4,11 @@ import MergeTrainPositionIndicator from 'ee/vue_merge_request_widget/components/ ...@@ -4,14 +4,11 @@ import MergeTrainPositionIndicator from 'ee/vue_merge_request_widget/components/
describe('MergeTrainPositionIndicator', () => { describe('MergeTrainPositionIndicator', () => {
let wrapper; let wrapper;
let vm;
const factory = propsData => { const factory = propsData => {
wrapper = shallowMount(MergeTrainPositionIndicator, { wrapper = shallowMount(MergeTrainPositionIndicator, {
propsData, propsData,
}); });
({ vm } = wrapper);
}; };
afterEach(() => { afterEach(() => {
...@@ -19,19 +16,21 @@ describe('MergeTrainPositionIndicator', () => { ...@@ -19,19 +16,21 @@ describe('MergeTrainPositionIndicator', () => {
}); });
describe('computed', () => { describe('computed', () => {
describe('message', () => { describe('template', () => {
it('should return the message with the correct position (i.e., index + 1)', () => { it('should render the correct message', () => {
factory({ mergeTrainIndex: 3 }); factory({ mergeTrainIndex: 3 });
expect(vm.message).toBe('In the merge train at position 4'); expect(trimText(wrapper.text())).toBe(
'Added to the merge train. There are 4 merge requests waiting to be merged',
);
}); });
});
describe('template', () => { it('should change the merge train message when the position is 1', () => {
it('should render the correct message', () => { factory({ mergeTrainIndex: 0 });
factory({ mergeTrainIndex: 3 });
expect(trimText(wrapper.text())).toBe('In the merge train at position 4'); expect(trimText(wrapper.text())).toBe(
'A new merge train has started and this merge request is the first of the queue.',
);
}); });
}); });
}); });
......
...@@ -29525,9 +29525,15 @@ msgstr "" ...@@ -29525,9 +29525,15 @@ msgstr ""
msgid "mrWidget|%{prefixToLinkStart}No pipeline%{prefixToLinkEnd} %{addPipelineLinkStart}Add the .gitlab-ci.yml file%{addPipelineLinkEnd} to create one." msgid "mrWidget|%{prefixToLinkStart}No pipeline%{prefixToLinkEnd} %{addPipelineLinkStart}Add the .gitlab-ci.yml file%{addPipelineLinkEnd} to create one."
msgstr "" msgstr ""
msgid "mrWidget|A new merge train has started and this merge request is the first of the queue."
msgstr ""
msgid "mrWidget|Added to the merge train by" msgid "mrWidget|Added to the merge train by"
msgstr "" msgstr ""
msgid "mrWidget|Added to the merge train. There are %{mergeTrainPosition} merge requests waiting to be merged"
msgstr ""
msgid "mrWidget|Allows commits from members who can merge to the target branch" msgid "mrWidget|Allows commits from members who can merge to the target branch"
msgstr "" msgstr ""
...@@ -29615,9 +29621,6 @@ msgstr "" ...@@ -29615,9 +29621,6 @@ msgstr ""
msgid "mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line" msgid "mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line"
msgstr "" msgstr ""
msgid "mrWidget|In the merge train at position %{mergeTrainPosition}"
msgstr ""
msgid "mrWidget|Jump to first unresolved thread" msgid "mrWidget|Jump to first unresolved thread"
msgstr "" 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