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
13283fbd
Commit
13283fbd
authored
Apr 02, 2020
by
Donald Cook
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added snowplow tracking to change direction
parent
63c0654e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
app/assets/javascripts/notes/components/sort_discussion.vue
app/assets/javascripts/notes/components/sort_discussion.vue
+3
-0
spec/frontend/notes/components/sort_discussion_spec.js
spec/frontend/notes/components/sort_discussion_spec.js
+8
-0
No files found.
app/assets/javascripts/notes/components/sort_discussion.vue
View file @
13283fbd
...
...
@@ -2,6 +2,7 @@
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
ASC
,
DESC
}
from
'
../constants
'
;
const
SORT_OPTIONS
=
[
...
...
@@ -14,6 +15,7 @@ export default {
components
:
{
GlIcon
,
},
mixins
:
[
Tracking
.
mixin
()],
computed
:
{
...
mapGetters
([
'
sortDirection
'
]),
selectedOption
()
{
...
...
@@ -31,6 +33,7 @@ export default {
}
this
.
setDiscussionSortDirection
(
direction
);
this
.
track
(
'
change_discussion_sort_direction
'
,
{
property
:
direction
});
},
isDropdownItemActive
(
sortDir
)
{
return
sortDir
===
this
.
sortDirection
;
...
...
spec/frontend/notes/components/sort_discussion_spec.js
View file @
13283fbd
...
...
@@ -3,6 +3,7 @@ import Vuex from 'vuex';
import
SortDiscussion
from
'
~/notes/components/sort_discussion.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
import
{
ASC
,
DESC
}
from
'
~/notes/constants
'
;
import
Tracking
from
'
~/tracking
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
...
...
@@ -22,6 +23,7 @@ describe('Sort Discussion component', () => {
beforeEach
(()
=>
{
store
=
createStore
();
jest
.
spyOn
(
Tracking
,
'
event
'
);
});
afterEach
(()
=>
{
...
...
@@ -37,6 +39,9 @@ describe('Sort Discussion component', () => {
wrapper
.
find
(
'
.js-newest-first
'
).
trigger
(
'
click
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
setDiscussionSortDirection
'
,
DESC
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
undefined
,
'
change_discussion_sort_direction
'
,
{
property
:
DESC
,
});
});
});
...
...
@@ -58,6 +63,9 @@ describe('Sort Discussion component', () => {
wrapper
.
find
(
'
.js-oldest-first
'
).
trigger
(
'
click
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
setDiscussionSortDirection
'
,
ASC
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
undefined
,
'
change_discussion_sort_direction
'
,
{
property
:
ASC
,
});
});
it
(
'
applies the active class to the correct button in the dropdown
'
,
()
=>
{
...
...
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