Commit b64b4cb3 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'andr3-update-ui-for-batch-suggestions-working' into 'master'

Hide Add to Batch button when suggestions can't be applied

See merge request gitlab-org/gitlab!35525
parents 20f759a6 088d7978
...@@ -53,14 +53,9 @@ export default { ...@@ -53,14 +53,9 @@ export default {
}, },
tooltipMessage() { tooltipMessage() {
return this.canApply return this.canApply
? __('This also resolves the discussion') ? __('This also resolves this thread')
: __("Can't apply as this line has changed or the suggestion already matches its content."); : __("Can't apply as this line has changed or the suggestion already matches its content.");
}, },
tooltipMessageBatch() {
return !this.canBeBatched
? __("Suggestions that change line count can't be added to batches, yet.")
: this.tooltipMessage;
},
isDisableButton() { isDisableButton() {
return this.isApplying || !this.canApply; return this.isApplying || !this.canApply;
}, },
...@@ -129,15 +124,14 @@ export default { ...@@ -129,15 +124,14 @@ export default {
</gl-deprecated-button> </gl-deprecated-button>
</div> </div>
<div v-else class="d-flex align-items-center"> <div v-else class="d-flex align-items-center">
<span v-if="canBeBatched" v-gl-tooltip.viewport="tooltipMessageBatch" tabindex="0">
<gl-deprecated-button <gl-deprecated-button
v-if="canBeBatched && !isDisableButton"
class="btn-inverted js-add-to-batch-btn btn-grouped" class="btn-inverted js-add-to-batch-btn btn-grouped"
:disabled="isDisableButton" :disabled="isDisableButton"
@click="addSuggestionToBatch" @click="addSuggestionToBatch"
> >
{{ __('Add suggestion to batch') }} {{ __('Add suggestion to batch') }}
</gl-deprecated-button> </gl-deprecated-button>
</span>
<span v-gl-tooltip.viewport="tooltipMessage" tabindex="0"> <span v-gl-tooltip.viewport="tooltipMessage" tabindex="0">
<gl-deprecated-button <gl-deprecated-button
class="btn-inverted js-apply-btn btn-grouped" class="btn-inverted js-apply-btn btn-grouped"
......
...@@ -22379,9 +22379,6 @@ msgstr "" ...@@ -22379,9 +22379,6 @@ msgstr ""
msgid "Suggestions must all be on the same branch." msgid "Suggestions must all be on the same branch."
msgstr "" msgstr ""
msgid "Suggestions that change line count can't be added to batches, yet."
msgstr ""
msgid "Suggestions:" msgid "Suggestions:"
msgstr "" msgstr ""
...@@ -23397,7 +23394,7 @@ msgstr "" ...@@ -23397,7 +23394,7 @@ msgstr ""
msgid "This also resolves all related threads" msgid "This also resolves all related threads"
msgstr "" msgstr ""
msgid "This also resolves the discussion" msgid "This also resolves this thread"
msgstr "" msgstr ""
msgid "This application was created by %{link_to_owner}." msgid "This application was created by %{link_to_owner}."
......
...@@ -71,7 +71,7 @@ describe('Suggestion Diff component', () => { ...@@ -71,7 +71,7 @@ describe('Suggestion Diff component', () => {
it('renders correct tooltip message for apply button', () => { it('renders correct tooltip message for apply button', () => {
createComponent(); createComponent();
expect(wrapper.vm.tooltipMessage).toBe('This also resolves the discussion'); expect(wrapper.vm.tooltipMessage).toBe('This also resolves this thread');
}); });
describe('when apply suggestion is clicked', () => { describe('when apply suggestion is clicked', () => {
...@@ -227,11 +227,10 @@ describe('Suggestion Diff component', () => { ...@@ -227,11 +227,10 @@ describe('Suggestion Diff component', () => {
createComponent({ canApply: false }); createComponent({ canApply: false });
}); });
it('disables apply suggestion and add to batch buttons', () => { it('disables apply suggestion and hides add to batch button', () => {
expect(findApplyButton().exists()).toBe(true); expect(findApplyButton().exists()).toBe(true);
expect(findAddToBatchButton().exists()).toBe(true); expect(findAddToBatchButton().exists()).toBe(false);
expect(findApplyButton().attributes('disabled')).toBe('true'); expect(findApplyButton().attributes('disabled')).toBe('true');
expect(findAddToBatchButton().attributes('disabled')).toBe('true');
}); });
it('renders correct tooltip message for apply button', () => { it('renders correct tooltip message for apply button', () => {
......
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