Commit 7d8ad86e authored by Phil Hughes's avatar Phil Hughes

Merge branch '58369-hide-squash-commit' into 'master'

Hide squash commit edit on single commit MR

Closes #58369

See merge request gitlab-org/gitlab-ce!25807
parents 5a82810f 52c772f9
...@@ -20,7 +20,6 @@ export default { ...@@ -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"
......
...@@ -329,7 +329,7 @@ export default { ...@@ -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"
......
---
title: Resolve showing squash commit edit issue when only single commit is present
merge_request: 25807
author:
type: fixed
...@@ -673,7 +673,7 @@ describe('ReadyToMerge', () => { ...@@ -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', () => { ...@@ -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', () => { ...@@ -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();
}); });
......
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