diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js b/spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js index 436e1fd6815..c6e147899e4 100644 --- a/spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js +++ b/spec/frontend/vue_shared/components/markdown/suggestion_diff_header_spec.js @@ -69,11 +69,6 @@ describe('Suggestion Diff component', () => { expect(addToBatchBtn.html().includes('Add suggestion to batch')).toBe(true); }); - it('renders correct tooltip message for apply button', () => { - createComponent(); - expect(wrapper.vm.tooltipMessage).toBe('This also resolves this thread'); - }); - describe('when apply suggestion is clicked', () => { beforeEach(() => { createComponent(); @@ -232,11 +227,18 @@ describe('Suggestion Diff component', () => { expect(findAddToBatchButton().exists()).toBe(false); expect(findApplyButton().attributes('disabled')).toBe('true'); }); + }); + + describe('tooltip message for apply button', () => { + it('renders correct tooltip message when button is applicable', () => { + createComponent(); + expect(wrapper.vm.tooltipMessage).toBe('This also resolves this thread'); + }); - it('renders correct tooltip message for apply button', () => { - expect(wrapper.vm.tooltipMessage).toBe( - "Can't apply as this line has changed or the suggestion already matches its content.", - ); + it('renders the inapplicable reason in the tooltip when button is not applicable', () => { + const inapplicableReason = 'lorem'; + createComponent({ canApply: false, inapplicableReason }); + expect(wrapper.vm.tooltipMessage).toBe(inapplicableReason); }); }); }); |