Added a condition on squash message display

- also added a caret back to GlDropdown
This commit is contained in:
Natalia Tepluhina 2019-03-07 09:26:31 +00:00 committed by Phil Hughes
parent 5a82810faf
commit 52c772f9c3
4 changed files with 23 additions and 5 deletions

View file

@ -20,7 +20,6 @@ export default {
<div> <div>
<gl-dropdown <gl-dropdown
right right
no-caret
text="Use an existing commit message" text="Use an existing commit message"
variant="link" variant="link"
class="mr-commit-dropdown" class="mr-commit-dropdown"

View file

@ -329,7 +329,7 @@ export default {
> >
<ul class="border-top content-list commits-list flex-list"> <ul class="border-top content-list commits-list flex-list">
<commit-edit <commit-edit
v-if="squashBeforeMerge" v-if="squashBeforeMerge && shouldShowSquashBeforeMerge"
v-model="squashCommitMessage" v-model="squashCommitMessage"
:label="__('Squash commit message')" :label="__('Squash commit message')"
input-id="squash-message-edit" input-id="squash-message-edit"

View file

@ -0,0 +1,5 @@
---
title: Resolve showing squash commit edit issue when only single commit is present
merge_request: 25807
author:
type: fixed

View file

@ -673,7 +673,7 @@ describe('ReadyToMerge', () => {
.at(0) .at(0)
.props('label'); .props('label');
it('should have two edit components when squash is enabled', () => { it('should have two edit components when squash is enabled and there is more than 1 commit', () => {
createLocalComponent({ createLocalComponent({
mr: { mr: {
commitsCount: 2, commitsCount: 2,
@ -685,6 +685,18 @@ describe('ReadyToMerge', () => {
expect(findCommitEditElements().length).toBe(2); expect(findCommitEditElements().length).toBe(2);
}); });
it('should have one edit components when squash is enabled and there is 1 commit only', () => {
createLocalComponent({
mr: {
commitsCount: 1,
squash: true,
enableSquashBeforeMerge: true,
},
});
expect(findCommitEditElements().length).toBe(1);
});
it('should have correct edit merge commit label', () => { it('should have correct edit merge commit label', () => {
createLocalComponent(); createLocalComponent();
@ -711,8 +723,10 @@ describe('ReadyToMerge', () => {
expect(findCommitDropdownElement().exists()).toBeFalsy(); expect(findCommitDropdownElement().exists()).toBeFalsy();
}); });
it('should be rendered if squash is enabled', () => { it('should be rendered if squash is enabled and there is more than 1 commit', () => {
createLocalComponent({ mr: { squash: true } }); createLocalComponent({
mr: { enableSquashBeforeMerge: true, squash: true, commitsCount: 2 },
});
expect(findCommitDropdownElement().exists()).toBeTruthy(); expect(findCommitDropdownElement().exists()).toBeTruthy();
}); });