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
c84960b2
Commit
c84960b2
authored
Mar 30, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tracking on modal show for pipeline success
- needed for feature to be complete.
parent
7b2cd340
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
7 deletions
+56
-7
app/assets/javascripts/blob/pipeline_tour_success_modal.vue
app/assets/javascripts/blob/pipeline_tour_success_modal.vue
+22
-0
spec/frontend/blob/pipeline_tour_success_mock_data.js
spec/frontend/blob/pipeline_tour_success_mock_data.js
+7
-0
spec/frontend/blob/pipeline_tour_success_spec.js
spec/frontend/blob/pipeline_tour_success_spec.js
+27
-7
No files found.
app/assets/javascripts/blob/pipeline_tour_success_modal.vue
View file @
c84960b2
...
@@ -3,6 +3,9 @@ import { GlModal, GlSprintf, GlLink } from '@gitlab/ui';
...
@@ -3,6 +3,9 @@ import { GlModal, GlSprintf, GlLink } from '@gitlab/ui';
import
{
sprintf
,
s__
,
__
}
from
'
~/locale
'
;
import
{
sprintf
,
s__
,
__
}
from
'
~/locale
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
glEmojiTag
}
from
'
~/emoji
'
;
import
{
glEmojiTag
}
from
'
~/emoji
'
;
import
Tracking
from
'
~/tracking
'
;
const
trackingMixin
=
Tracking
.
mixin
();
export
default
{
export
default
{
beginnerLink
:
beginnerLink
:
...
@@ -23,6 +26,7 @@ export default {
...
@@ -23,6 +26,7 @@ export default {
GlSprintf
,
GlSprintf
,
GlLink
,
GlLink
,
},
},
mixins
:
[
trackingMixin
],
props
:
{
props
:
{
goToPipelinesPath
:
{
goToPipelinesPath
:
{
type
:
String
,
type
:
String
,
...
@@ -32,11 +36,29 @@ export default {
...
@@ -32,11 +36,29 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
humanAccess
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
tracking
:
{
label
:
'
congratulate_first_pipeline
'
,
property
:
this
.
humanAccess
,
},
};
},
},
mounted
()
{
mounted
()
{
this
.
trackOnShow
();
this
.
disableModalFromRenderingAgain
();
this
.
disableModalFromRenderingAgain
();
},
},
methods
:
{
methods
:
{
trackOnShow
()
{
if
(
!
this
.
popoverDismissed
)
{
this
.
track
();
}
},
disableModalFromRenderingAgain
()
{
disableModalFromRenderingAgain
()
{
Cookies
.
remove
(
this
.
commitCookie
);
Cookies
.
remove
(
this
.
commitCookie
);
},
},
...
...
spec/frontend/blob/pipeline_tour_success_mock_data.js
0 → 100644
View file @
c84960b2
const
modalProps
=
{
goToPipelinesPath
:
'
some_pipeline_path
'
,
commitCookie
:
'
some_cookie
'
,
humanAccess
:
'
maintainer
'
,
};
export
default
modalProps
;
spec/frontend/blob/pipeline_tour_success_spec.js
View file @
c84960b2
...
@@ -2,19 +2,16 @@ import pipelineTourSuccess from '~/blob/pipeline_tour_success_modal.vue';
...
@@ -2,19 +2,16 @@ import pipelineTourSuccess from '~/blob/pipeline_tour_success_modal.vue';
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Cookies
from
'
js-cookie
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
GlSprintf
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
GlSprintf
,
GlModal
}
from
'
@gitlab/ui
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
modalProps
from
'
./pipeline_tour_success_mock_data
'
;
describe
(
'
PipelineTourSuccessModal
'
,
()
=>
{
describe
(
'
PipelineTourSuccessModal
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
cookieSpy
;
let
cookieSpy
;
const
goToPipelinesPath
=
'
some_pipeline_path
'
;
const
commitCookie
=
'
some_cookie
'
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
pipelineTourSuccess
,
{
wrapper
=
shallowMount
(
pipelineTourSuccess
,
{
propsData
:
{
propsData
:
modalProps
,
goToPipelinesPath
,
commitCookie
,
},
});
});
cookieSpy
=
jest
.
spyOn
(
Cookies
,
'
remove
'
);
cookieSpy
=
jest
.
spyOn
(
Cookies
,
'
remove
'
);
...
@@ -35,6 +32,29 @@ describe('PipelineTourSuccessModal', () => {
...
@@ -35,6 +32,29 @@ describe('PipelineTourSuccessModal', () => {
it
(
'
calls to remove cookie
'
,
()
=>
{
it
(
'
calls to remove cookie
'
,
()
=>
{
wrapper
.
vm
.
disableModalFromRenderingAgain
();
wrapper
.
vm
.
disableModalFromRenderingAgain
();
expect
(
cookieSpy
).
toHaveBeenCalledWith
(
commitCookie
);
expect
(
cookieSpy
).
toHaveBeenCalledWith
(
modalProps
.
commitCookie
);
});
describe
(
'
tracking
'
,
()
=>
{
let
trackingSpy
;
beforeEach
(()
=>
{
trackingSpy
=
mockTracking
(
'
_category_
'
,
wrapper
.
element
,
jest
.
spyOn
);
});
afterEach
(()
=>
{
unmockTracking
();
});
it
(
'
send event for basic view of popover
'
,
()
=>
{
document
.
body
.
dataset
.
page
=
'
projects:blob:show
'
;
wrapper
.
vm
.
trackOnShow
();
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
undefined
,
{
label
:
'
congratulate_first_pipeline
'
,
property
:
modalProps
.
humanAccess
,
});
});
});
});
});
});
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