diff options
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js | 8 | ||||
-rw-r--r-- | spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js b/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js index fb78ea92da1..7c15abfff10 100644 --- a/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js +++ b/app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js @@ -11,10 +11,6 @@ export default function deviseState(data) { return 'conflicts'; } else if (data.work_in_progress) { return 'workInProgress'; - } else if (this.mergeWhenPipelineSucceeds) { - return this.mergeError ? 'autoMergeFailed' : 'mergeWhenPipelineSucceeds'; - } else if (!this.canMerge) { - return 'notAllowedToMerge'; } else if (this.onlyAllowMergeIfPipelineSucceeds && this.isPipelineFailed) { return 'pipelineFailed'; } else if (this.hasMergeableDiscussionsState) { @@ -23,6 +19,10 @@ export default function deviseState(data) { return 'pipelineBlocked'; } else if (this.hasSHAChanged) { return 'shaMismatch'; + } else if (this.mergeWhenPipelineSucceeds) { + return this.mergeError ? 'autoMergeFailed' : 'mergeWhenPipelineSucceeds'; + } else if (!this.canMerge) { + return 'notAllowedToMerge'; } else if (this.canBeMerged) { return 'readyToMerge'; } diff --git a/spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js b/spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js index 9a331d99865..179e42a7cc4 100644 --- a/spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js +++ b/spec/javascripts/vue_mr_widget/stores/get_state_key_spec.js @@ -25,6 +25,12 @@ describe('getStateKey', () => { context.canBeMerged = true; expect(bound()).toEqual('readyToMerge'); + context.canMerge = false; + expect(bound()).toEqual('notAllowedToMerge'); + + context.mergeWhenPipelineSucceeds = true; + expect(bound()).toEqual('mergeWhenPipelineSucceeds'); + context.hasSHAChanged = true; expect(bound()).toEqual('shaMismatch'); @@ -38,12 +44,6 @@ describe('getStateKey', () => { context.isPipelineFailed = true; expect(bound()).toEqual('pipelineFailed'); - context.canMerge = false; - expect(bound()).toEqual('notAllowedToMerge'); - - context.mergeWhenPipelineSucceeds = true; - expect(bound()).toEqual('mergeWhenPipelineSucceeds'); - data.work_in_progress = true; expect(bound()).toEqual('workInProgress'); |