Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
758cb0c2
Commit
758cb0c2
authored
Aug 05, 2021
by
Enrique Alcantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code review feedback
- Use shallowMountExtended - Simplify tracking tests
parent
8a8a9842
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
22 deletions
+14
-22
spec/frontend/content_editor/components/formatting_bubble_menu_spec.js
.../content_editor/components/formatting_bubble_menu_spec.js
+9
-14
spec/frontend/content_editor/components/top_toolbar_spec.js
spec/frontend/content_editor/components/top_toolbar_spec.js
+5
-8
No files found.
spec/frontend/content_editor/components/formatting_bubble_menu_spec.js
View file @
758cb0c2
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
,
{
...
...
spec/frontend/content_editor/components/top_toolbar_spec.js
View file @
758cb0c2
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, {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment