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
18ec1539
Commit
18ec1539
authored
Aug 23, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
06976a8f
8634cca3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
app/assets/javascripts/tracking.js
app/assets/javascripts/tracking.js
+7
-1
qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb
.../3_create/repository/user_views_commit_diff_patch_spec.rb
+1
-1
spec/frontend/tracking_spec.js
spec/frontend/tracking_spec.js
+27
-0
No files found.
app/assets/javascripts/tracking.js
View file @
18ec1539
...
...
@@ -15,8 +15,14 @@ const extractData = (el, opts = {}) => {
};
export
default
class
Tracking
{
static
trackable
()
{
return
!
[
'
1
'
,
'
yes
'
].
includes
(
window
.
doNotTrack
||
navigator
.
doNotTrack
||
navigator
.
msDoNotTrack
,
);
}
static
enabled
()
{
return
typeof
window
.
snowplow
===
'
function
'
;
return
typeof
window
.
snowplow
===
'
function
'
&&
this
.
trackable
()
;
}
static
event
(
category
=
document
.
body
.
dataset
.
page
,
event
=
'
generic
'
,
data
=
{})
{
...
...
qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb
View file @
18ec1539
...
...
@@ -49,7 +49,7 @@ module QA
Page
::
Project
::
Commit
::
Show
.
perform
(
&
:select_email_patches
)
expect
(
page
).
to
have_content
(
"From:
#{
@user
.
name
}
<
#{
@user
.
public_email
}
>"
)
expect
(
page
).
to
have_content
(
/From: "?
#{
Regexp
.
escape
(
@user
.
name
)
}
"? <
#{
@user
.
public_email
}
>/
)
expect
(
page
).
to
have_content
(
'Subject: [PATCH] Add second file'
)
expect
(
page
).
to
have_content
(
'diff --git a/second b/second'
)
end
...
...
spec/frontend/tracking_spec.js
View file @
18ec1539
...
...
@@ -15,6 +15,12 @@ describe('Tracking', () => {
snowplowSpy
=
jest
.
spyOn
(
window
,
'
snowplow
'
);
});
afterEach
(()
=>
{
window
.
doNotTrack
=
undefined
;
navigator
.
doNotTrack
=
undefined
;
navigator
.
msDoNotTrack
=
undefined
;
});
it
(
'
tracks to snowplow (our current tracking system)
'
,
()
=>
{
Tracking
.
event
(
'
_category_
'
,
'
_eventName_
'
,
{
label
:
'
_label_
'
});
...
...
@@ -31,6 +37,27 @@ describe('Tracking', () => {
expect
(
snowplowSpy
).
not
.
toHaveBeenCalled
();
});
it
(
'
skips tracking if the user does not want to be tracked (general spec)
'
,
()
=>
{
window
.
doNotTrack
=
'
1
'
;
Tracking
.
event
(
'
_category_
'
,
'
_eventName_
'
);
expect
(
snowplowSpy
).
not
.
toHaveBeenCalled
();
});
it
(
'
skips tracking if the user does not want to be tracked (firefox legacy)
'
,
()
=>
{
navigator
.
doNotTrack
=
'
yes
'
;
Tracking
.
event
(
'
_category_
'
,
'
_eventName_
'
);
expect
(
snowplowSpy
).
not
.
toHaveBeenCalled
();
});
it
(
'
skips tracking if the user does not want to be tracked (IE legacy)
'
,
()
=>
{
navigator
.
msDoNotTrack
=
'
1
'
;
Tracking
.
event
(
'
_category_
'
,
'
_eventName_
'
);
expect
(
snowplowSpy
).
not
.
toHaveBeenCalled
();
});
});
describe
(
'
tracking interface events
'
,
()
=>
{
...
...
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