Commit 758cb0c2 authored by Enrique Alcantara's avatar Enrique Alcantara

Code review feedback

- Use shallowMountExtended
- Simplify tracking tests
parent 8a8a9842
import { BubbleMenu } from '@tiptap/vue-2';
import { shallowMount } from '@vue/test-utils';
import { mockTracking } from 'helpers/tracking_helper';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import FormattingBubbleMenu from '~/content_editor/components/formatting_bubble_menu.vue';
import {
......@@ -22,13 +21,11 @@ describe('content_editor/components/top_toolbar', () => {
};
const buildWrapper = () => {
wrapper = extendedWrapper(
shallowMount(FormattingBubbleMenu, {
provide: {
tiptapEditor,
},
}),
);
wrapper = shallowMountExtended(FormattingBubbleMenu, {
provide: {
tiptapEditor,
},
});
};
beforeEach(() => {
......@@ -67,12 +64,10 @@ describe('content_editor/components/top_toolbar', () => {
});
});
it.each`
eventData
${{ contentType: 'bold' }}
${{ contentType: 'italic', value: 1 }}
`('tracks the execution of toolbar controls', ({ eventData }) => {
it('tracks the execution of toolbar controls', () => {
const eventData = { contentType: 'italic', value: 1 };
const { contentType, value } = eventData;
wrapper.findByTestId(testId).vm.$emit('execute', eventData);
expect(trackingSpy).toHaveBeenCalledWith(undefined, BUBBLE_MENU_TRACKING_ACTION, {
......
import { shallowMount } from '@vue/test-utils';
import { mockTracking } from 'helpers/tracking_helper';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import TopToolbar from '~/content_editor/components/top_toolbar.vue';
import {
TOOLBAR_CONTROL_TRACKING_ACTION,
......@@ -12,7 +11,7 @@ describe('content_editor/components/top_toolbar', () => {
let trackingSpy;
const buildWrapper = () => {
wrapper = extendedWrapper(shallowMount(TopToolbar));
wrapper = shallowMountExtended(TopToolbar);
};
beforeEach(() => {
......@@ -50,12 +49,10 @@ describe('content_editor/components/top_toolbar', () => {
});
});
it.each`
eventData
${{ contentType: 'bold' }}
${{ contentType: 'blockquote', value: 1 }}
`('tracks the execution of toolbar controls', ({ eventData }) => {
it('tracks the execution of toolbar controls', () => {
const eventData = { contentType: 'blockquote', value: 1 };
const { contentType, value } = eventData;
wrapper.findByTestId(testId).vm.$emit('execute', eventData);
expect(trackingSpy).toHaveBeenCalledWith(undefined, TOOLBAR_CONTROL_TRACKING_ACTION, {
......
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