diff --git a/app/assets/javascripts/notes/components/discussion_jump_to_next_button.vue b/app/assets/javascripts/notes/components/discussion_jump_to_next_button.vue new file mode 100644 index 00000000000..07a5bda6bcb --- /dev/null +++ b/app/assets/javascripts/notes/components/discussion_jump_to_next_button.vue @@ -0,0 +1,28 @@ + + + diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index 1a9723de856..8add7278f9b 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -23,6 +23,7 @@ import autosave from '../mixins/autosave'; import noteable from '../mixins/noteable'; import resolvable from '../mixins/resolvable'; import discussionNavigation from '../mixins/discussion_navigation'; +import jumpToNextDiscussionButton from './discussion_jump_to_next_button.vue'; export default { name: 'NoteableDiscussion', @@ -34,6 +35,7 @@ export default { noteSignedOutWidget, noteEditedText, noteForm, + jumpToNextDiscussionButton, toggleRepliesWidget, placeholderNote, placeholderSystemNote, @@ -476,16 +478,10 @@ Please check your network connection and try again.`; -
- -
+ diff --git a/changelogs/unreleased/refactor-56369-extract-jump-to-next-discussion-button.yml b/changelogs/unreleased/refactor-56369-extract-jump-to-next-discussion-button.yml new file mode 100644 index 00000000000..9a0d16c2d70 --- /dev/null +++ b/changelogs/unreleased/refactor-56369-extract-jump-to-next-discussion-button.yml @@ -0,0 +1,5 @@ +--- +title: Extracted JumpToNextDiscussionButton to its own component +author: Martin Hobert +merge_request: 24506 +type: other diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 2806edbecf8..0e6cb5ac4ed 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4345,6 +4345,9 @@ msgstr "" msgid "Merge requests are a place to propose changes you've made to a project and discuss those changes with others" msgstr "" +msgid "MergeRequests|Jump to next unresolved discussion" +msgstr "" + msgid "MergeRequests|Resolve this discussion in a new issue" msgstr "" diff --git a/spec/javascripts/notes/components/discussion_jump_to_next_button_spec.js b/spec/javascripts/notes/components/discussion_jump_to_next_button_spec.js new file mode 100644 index 00000000000..c41b29fa788 --- /dev/null +++ b/spec/javascripts/notes/components/discussion_jump_to_next_button_spec.js @@ -0,0 +1,33 @@ +import jumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_next_button.vue'; +import { shallowMount, createLocalVue } from '@vue/test-utils'; + +const localVue = createLocalVue(); + +describe('jumpToNextDiscussionButton', () => { + let wrapper; + + beforeEach(() => { + wrapper = shallowMount(jumpToNextDiscussionButton, { + localVue, + sync: false, + }); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + it('emits onClick event on button click', done => { + const button = wrapper.find({ ref: 'button' }); + + button.trigger('click'); + + localVue.nextTick(() => { + expect(wrapper.emitted()).toEqual({ + onClick: [[]], + }); + + done(); + }); + }); +});