Commit 33607091 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-rebase-failing-tests' into 'master'

Correctly show rebase state in MR widget

Closes #45942

See merge request gitlab-org/gitlab-ce!24300
parents cfa96a83 81a52c27
......@@ -13,6 +13,8 @@ export default function deviseState(data) {
return stateKey.conflicts;
} else if (data.work_in_progress) {
return stateKey.workInProgress;
} else if (this.shouldBeRebased) {
return stateKey.rebase;
} else if (this.onlyAllowMergeIfPipelineSucceeds && this.isPipelineFailed) {
return stateKey.pipelineFailed;
} else if (this.hasMergeableDiscussionsState) {
......@@ -25,8 +27,6 @@ export default function deviseState(data) {
return this.mergeError ? stateKey.autoMergeFailed : stateKey.mergeWhenPipelineSucceeds;
} else if (!this.canMerge) {
return stateKey.notAllowedToMerge;
} else if (this.shouldBeRebased) {
return stateKey.rebase;
} else if (this.canBeMerged) {
return stateKey.readyToMerge;
}
......
---
title: Fixed rebase button not showing in merge request widget
merge_request:
author:
type: fixed
......@@ -76,4 +76,28 @@ describe('getStateKey', () => {
expect(bound()).toEqual('archived');
});
it('returns rebased state key', () => {
const context = {
mergeStatus: 'checked',
mergeWhenPipelineSucceeds: false,
canMerge: true,
onlyAllowMergeIfPipelineSucceeds: true,
isPipelineFailed: true,
hasMergeableDiscussionsState: false,
isPipelineBlocked: false,
canBeMerged: false,
shouldBeRebased: true,
};
const data = {
project_archived: false,
branch_missing: false,
commits_count: 2,
has_conflicts: false,
work_in_progress: false,
};
const bound = getStateKey.bind(context, data);
expect(bound()).toEqual('rebase');
});
});
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