Commit b9e40e1d authored by Mike Greiling's avatar Mike Greiling

Add tests for changes in comment_type_dropdown event handlers

parent 0a761e5f
......@@ -47,8 +47,18 @@ describe('CommentTypeDropdown component', () => {
it('Should emit `change` event when clicking on an alternate dropdown option', () => {
mountComponent({ props: { noteType: constants.DISCUSSION } });
findCommentDropdownOption().vm.$emit('click');
findDiscussionDropdownOption().vm.$emit('click');
const event = {
type: 'click',
stopPropagation: jest.fn(),
preventDefault: jest.fn(),
};
findCommentDropdownOption().vm.$emit('click', event);
findDiscussionDropdownOption().vm.$emit('click', event);
// ensure the native events don't trigger anything
expect(event.stopPropagation).toHaveBeenCalledTimes(2);
expect(event.preventDefault).toHaveBeenCalledTimes(2);
expect(wrapper.emitted('change')[0]).toEqual([constants.COMMENT]);
expect(wrapper.emitted('change').length).toEqual(1);
......
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