diff options
Diffstat (limited to 'spec/frontend/notes/components/discussion_filter_note_spec.js')
-rw-r--r-- | spec/frontend/notes/components/discussion_filter_note_spec.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/frontend/notes/components/discussion_filter_note_spec.js b/spec/frontend/notes/components/discussion_filter_note_spec.js index 4701108d315..d35f8f7c28d 100644 --- a/spec/frontend/notes/components/discussion_filter_note_spec.js +++ b/spec/frontend/notes/components/discussion_filter_note_spec.js @@ -1,4 +1,5 @@ import { shallowMount } from '@vue/test-utils'; +import { GlButton, GlSprintf } from '@gitlab/ui'; import DiscussionFilterNote from '~/notes/components/discussion_filter_note.vue'; import eventHub from '~/notes/event_hub'; @@ -6,7 +7,11 @@ describe('DiscussionFilterNote component', () => { let wrapper; const createComponent = () => { - wrapper = shallowMount(DiscussionFilterNote); + wrapper = shallowMount(DiscussionFilterNote, { + stubs: { + GlSprintf, + }, + }); }; beforeEach(() => { @@ -19,21 +24,27 @@ describe('DiscussionFilterNote component', () => { }); it('timelineContent renders a string containing instruction for switching feed type', () => { - expect(wrapper.find({ ref: 'timelineContent' }).html()).toBe( - "<div>You're only seeing <b>other activity</b> in the feed. To add a comment, switch to one of the following options.</div>", + expect(wrapper.find('[data-testid="discussion-filter-timeline-content"]').html()).toBe( + '<div data-testid="discussion-filter-timeline-content">You\'re only seeing <b>other activity</b> in the feed. To add a comment, switch to one of the following options.</div>', ); }); it('emits `dropdownSelect` event with 0 parameter on clicking Show all activity button', () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); - wrapper.find({ ref: 'showAllActivity' }).vm.$emit('click'); + wrapper + .findAll(GlButton) + .at(0) + .vm.$emit('click'); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 0); }); it('emits `dropdownSelect` event with 1 parameter on clicking Show comments only button', () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); - wrapper.find({ ref: 'showComments' }).vm.$emit('click'); + wrapper + .findAll(GlButton) + .at(1) + .vm.$emit('click'); expect(eventHub.$emit).toHaveBeenCalledWith('dropdownSelect', 1); }); |