diff options
Diffstat (limited to 'spec/frontend/notes/components/discussion_jump_to_next_button_spec.js')
-rw-r--r-- | spec/frontend/notes/components/discussion_jump_to_next_button_spec.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js b/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js index a00dd445c4f..2ff9dbc5c19 100644 --- a/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js +++ b/spec/frontend/notes/components/discussion_jump_to_next_button_spec.js @@ -3,9 +3,12 @@ import JumpToNextDiscussionButton from '~/notes/components/discussion_jump_to_ne describe('JumpToNextDiscussionButton', () => { let wrapper; + const fromDiscussionId = 'abc123'; beforeEach(() => { - wrapper = shallowMount(JumpToNextDiscussionButton); + wrapper = shallowMount(JumpToNextDiscussionButton, { + propsData: { fromDiscussionId }, + }); }); afterEach(() => { @@ -15,4 +18,11 @@ describe('JumpToNextDiscussionButton', () => { it('matches the snapshot', () => { expect(wrapper.vm.$el).toMatchSnapshot(); }); + + it('calls jumpToNextRelativeDiscussion when clicked', () => { + const jumpToNextRelativeDiscussion = jest.fn(); + wrapper.setMethods({ jumpToNextRelativeDiscussion }); + wrapper.find({ ref: 'button' }).trigger('click'); + expect(jumpToNextRelativeDiscussion).toHaveBeenCalledWith(fromDiscussionId); + }); }); |