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