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
ca701d32
Commit
ca701d32
authored
Nov 11, 2021
by
David O'Regan
Committed by
Kushal Pandya
Nov 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Wiki format tracking
parent
366d0e49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue
...s/javascripts/pages/shared/wikis/components/wiki_form.vue
+13
-1
app/assets/javascripts/pages/shared/wikis/constants.js
app/assets/javascripts/pages/shared/wikis/constants.js
+3
-2
spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
.../frontend/pages/shared/wikis/components/wiki_form_spec.js
+18
-8
No files found.
app/assets/javascripts/pages/shared/wikis/components/wiki_form.vue
View file @
ca701d32
...
...
@@ -16,9 +16,11 @@ import { __, s__, sprintf } from '~/locale';
import
Tracking
from
'
~/tracking
'
;
import
MarkdownField
from
'
~/vue_shared/components/markdown/field.vue
'
;
import
{
WIKI_CONTENT_EDITOR_TRACKING_LABEL
,
CONTENT_EDITOR_LOADED_ACTION
,
SAVED_USING_CONTENT_EDITOR_ACTION
,
WIKI_CONTENT_EDITOR_TRACKING_LABEL
,
WIKI_FORMAT_LABEL
,
WIKI_FORMAT_UPDATED_ACTION
,
}
from
'
../constants
'
;
const
trackingMixin
=
Tracking
.
mixin
({
...
...
@@ -219,6 +221,8 @@ export default {
this
.
trackFormSubmit
();
}
this
.
trackWikiFormat
();
// Wait until form field values are refreshed
await
this
.
$nextTick
();
...
...
@@ -304,6 +308,14 @@ export default {
}
},
trackWikiFormat
()
{
this
.
track
(
WIKI_FORMAT_UPDATED_ACTION
,
{
label
:
WIKI_FORMAT_LABEL
,
value
:
this
.
format
,
extra
:
{
project_path
:
this
.
pageInfo
.
path
,
old_format
:
this
.
pageInfo
.
format
},
});
},
dismissContentEditorAlert
()
{
this
.
isContentEditorAlertDismissed
=
true
;
},
...
...
app/assets/javascripts/pages/shared/wikis/constants.js
View file @
ca701d32
export
const
WIKI_CONTENT_EDITOR_TRACKING_LABEL
=
'
wiki_content_editor
'
;
export
const
CONTENT_EDITOR_LOADED_ACTION
=
'
content_editor_loaded
'
;
export
const
SAVED_USING_CONTENT_EDITOR_ACTION
=
'
saved_using_content_editor
'
;
export
const
WIKI_CONTENT_EDITOR_TRACKING_LABEL
=
'
wiki_content_editor
'
;
export
const
WIKI_FORMAT_LABEL
=
'
wiki_format
'
;
export
const
WIKI_FORMAT_UPDATED_ACTION
=
'
wiki_format_updated
'
;
spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
View file @
ca701d32
...
...
@@ -8,9 +8,11 @@ import waitForPromises from 'helpers/wait_for_promises';
import
ContentEditor
from
'
~/content_editor/components/content_editor.vue
'
;
import
WikiForm
from
'
~/pages/shared/wikis/components/wiki_form.vue
'
;
import
{
WIKI_CONTENT_EDITOR_TRACKING_LABEL
,
CONTENT_EDITOR_LOADED_ACTION
,
SAVED_USING_CONTENT_EDITOR_ACTION
,
WIKI_CONTENT_EDITOR_TRACKING_LABEL
,
WIKI_FORMAT_LABEL
,
WIKI_FORMAT_UPDATED_ACTION
,
}
from
'
~/pages/shared/wikis/constants
'
;
import
MarkdownField
from
'
~/vue_shared/components/markdown/field.vue
'
;
...
...
@@ -65,7 +67,6 @@ describe('WikiForm', () => {
const
pageInfoPersisted
=
{
...
pageInfoNew
,
persisted
:
true
,
title
:
'
My page
'
,
content
:
'
My page content
'
,
format
:
'
markdown
'
,
...
...
@@ -177,7 +178,7 @@ describe('WikiForm', () => {
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
text
()).
toContain
(
titleHelpText
);
expect
(
findTitleHelpLink
().
attributes
().
href
).
to
Equal
(
titleHelpLink
);
expect
(
findTitleHelpLink
().
attributes
().
href
).
to
Be
(
titleHelpLink
);
},
);
...
...
@@ -186,7 +187,7 @@ describe('WikiForm', () => {
await
wrapper
.
vm
.
$nextTick
();
expect
(
findMarkdownHelpLink
().
attributes
().
href
).
to
Equal
(
expect
(
findMarkdownHelpLink
().
attributes
().
href
).
to
Be
(
'
/help/user/markdown#wiki-specific-markdown
'
,
);
});
...
...
@@ -220,8 +221,8 @@ describe('WikiForm', () => {
expect
(
e
.
preventDefault
).
not
.
toHaveBeenCalled
();
});
it
(
'
does not trigger
tracking event
'
,
async
()
=>
{
expect
(
trackingSpy
).
not
.
toHaveBeenCalled
(
);
it
(
'
triggers wiki format
tracking event
'
,
async
()
=>
{
expect
(
trackingSpy
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
does not trim page content
'
,
()
=>
{
...
...
@@ -273,7 +274,7 @@ describe('WikiForm', () => {
({
persisted
,
redirectLink
})
=>
{
createWrapper
(
persisted
);
expect
(
findCancelButton
().
attributes
().
href
).
to
Equal
(
redirectLink
);
expect
(
findCancelButton
().
attributes
().
href
).
to
Be
(
redirectLink
);
},
);
});
...
...
@@ -438,7 +439,7 @@ describe('WikiForm', () => {
});
});
it
(
'
triggers tracking event on form submit
'
,
async
()
=>
{
it
(
'
triggers tracking event
s
on form submit
'
,
async
()
=>
{
triggerFormSubmit
();
await
wrapper
.
vm
.
$nextTick
();
...
...
@@ -446,6 +447,15 @@ describe('WikiForm', () => {
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
SAVED_USING_CONTENT_EDITOR_ACTION
,
{
label
:
WIKI_CONTENT_EDITOR_TRACKING_LABEL
,
});
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
WIKI_FORMAT_UPDATED_ACTION
,
{
label
:
WIKI_FORMAT_LABEL
,
value
:
findFormat
().
element
.
value
,
extra
:
{
old_format
:
pageInfoPersisted
.
format
,
project_path
:
pageInfoPersisted
.
path
,
},
});
});
it
(
'
updates content from content editor on form submit
'
,
async
()
=>
{
...
...
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