Commit b775841a authored by jboyson's avatar jboyson

Remove mr_widget_merge_help and refs

Since one logic branch depends on a prop that is never pased in,
this entire component is no longer needed.

Remove component.
Remove ref to component in parent.
Update specs accordingly.
parent bacc60c6
<script>
import { GlButton, GlModalDirective } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
export default {
name: 'MRWidgetMergeHelp',
components: {
GlButton,
},
directives: {
GlModalDirective,
},
props: {
missingBranch: {
type: String,
required: false,
default: '',
},
},
computed: {
missingBranchInfo() {
return sprintf(
s__(
'mrWidget|If the %{branch} branch exists in your local repository, you can merge this merge request manually using the',
),
{ branch: this.missingBranch },
);
},
},
};
</script>
<template>
<section class="gl-py-3 gl-pr-3 gl-pl-5 gl-ml-7 mr-widget-help gl-font-style-italic">
<template v-if="missingBranch">
{{ missingBranchInfo }}
</template>
<template v-else>
{{ s__('mrWidget|You can merge this merge request manually using the') }}
</template>
<gl-button
v-gl-modal-directive="'modal-merge-info'"
variant="link"
class="gl-mt-n2 js-open-modal-help"
>
{{ s__('mrWidget|command line') }}
</gl-button>
</section>
</template>
...@@ -18,7 +18,6 @@ import GroupedTestReportsApp from '../reports/components/grouped_test_reports_ap ...@@ -18,7 +18,6 @@ import GroupedTestReportsApp from '../reports/components/grouped_test_reports_ap
import Loading from './components/loading.vue'; import Loading from './components/loading.vue';
import MrWidgetAlertMessage from './components/mr_widget_alert_message.vue'; import MrWidgetAlertMessage from './components/mr_widget_alert_message.vue';
import WidgetHeader from './components/mr_widget_header.vue'; import WidgetHeader from './components/mr_widget_header.vue';
import WidgetMergeHelp from './components/mr_widget_merge_help.vue';
import MrWidgetPipelineContainer from './components/mr_widget_pipeline_container.vue'; import MrWidgetPipelineContainer from './components/mr_widget_pipeline_container.vue';
import WidgetRelatedLinks from './components/mr_widget_related_links.vue'; import WidgetRelatedLinks from './components/mr_widget_related_links.vue';
import WidgetSuggestPipeline from './components/mr_widget_suggest_pipeline.vue'; import WidgetSuggestPipeline from './components/mr_widget_suggest_pipeline.vue';
...@@ -59,7 +58,6 @@ export default { ...@@ -59,7 +58,6 @@ export default {
// ExtensionsContainer, // ExtensionsContainer,
'mr-widget-header': WidgetHeader, 'mr-widget-header': WidgetHeader,
'mr-widget-suggest-pipeline': WidgetSuggestPipeline, 'mr-widget-suggest-pipeline': WidgetSuggestPipeline,
'mr-widget-merge-help': WidgetMergeHelp,
MrWidgetPipelineContainer, MrWidgetPipelineContainer,
'mr-widget-related-links': WidgetRelatedLinks, 'mr-widget-related-links': WidgetRelatedLinks,
MrWidgetAlertMessage, MrWidgetAlertMessage,
...@@ -140,9 +138,6 @@ export default { ...@@ -140,9 +138,6 @@ export default {
componentName() { componentName() {
return stateMaps.stateToComponentMap[this.mr.state]; return stateMaps.stateToComponentMap[this.mr.state];
}, },
shouldRenderMergeHelp() {
return stateMaps.statesToShowHelpWidget.indexOf(this.mr.state) > -1;
},
hasPipelineMustSucceedConflict() { hasPipelineMustSucceedConflict() {
return !this.mr.hasCI && this.mr.onlyAllowMergeIfPipelineSucceeds; return !this.mr.hasCI && this.mr.onlyAllowMergeIfPipelineSucceeds;
}, },
...@@ -530,9 +525,6 @@ export default { ...@@ -530,9 +525,6 @@ export default {
<source-branch-removal-status v-if="shouldRenderSourceBranchRemovalStatus" /> <source-branch-removal-status v-if="shouldRenderSourceBranchRemovalStatus" />
</div> </div>
</div> </div>
<div v-if="shouldRenderMergeHelp" class="mr-widget-footer">
<mr-widget-merge-help />
</div>
</div> </div>
<mr-widget-pipeline-container <mr-widget-pipeline-container
v-if="shouldRenderMergedPipeline" v-if="shouldRenderMergedPipeline"
......
import { shallowMount } from '@vue/test-utils';
import MergeHelpComponent from '~/vue_merge_request_widget/components/mr_widget_merge_help.vue';
describe('MRWidgetMergeHelp', () => {
let wrapper;
const createComponent = ({ props = {} } = {}) => {
wrapper = shallowMount(MergeHelpComponent, {
propsData: {
missingBranch: 'this-is-not-the-branch-you-are-looking-for',
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('with missing branch', () => {
beforeEach(() => {
createComponent();
});
it('renders missing branch information', () => {
expect(wrapper.find('.mr-widget-help').text()).toContain(
'If the this-is-not-the-branch-you-are-looking-for branch exists in your local repository',
);
});
});
describe('without missing branch', () => {
beforeEach(() => {
createComponent({
props: { missingBranch: '' },
});
});
it('renders information about how to merge manually', () => {
expect(wrapper.find('.mr-widget-help').text()).toContain(
'You can merge this merge request manually',
);
});
});
});
...@@ -91,18 +91,6 @@ describe('MrWidgetOptions', () => { ...@@ -91,18 +91,6 @@ describe('MrWidgetOptions', () => {
}); });
}); });
describe('shouldRenderMergeHelp', () => {
it('should return false for the initial merged state', () => {
expect(wrapper.vm.shouldRenderMergeHelp).toBeFalsy();
});
it('should return true for a state which requires help widget', () => {
wrapper.vm.mr.state = 'conflicts';
expect(wrapper.vm.shouldRenderMergeHelp).toBeTruthy();
});
});
describe('shouldRenderPipelines', () => { describe('shouldRenderPipelines', () => {
it('should return true when hasCI is true', () => { it('should return true when hasCI is true', () => {
wrapper.vm.mr.hasCI = true; wrapper.vm.mr.hasCI = true;
......
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