Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
3676d7e1
Commit
3676d7e1
authored
Mar 22, 2019
by
Hannah Stepanek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add common funcs for group-list-items
parent
228b0b12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
group-list-item-common.js
src/sidebar/util/group-list-item-common.js
+14
-0
group-list-item-common-test.js
src/sidebar/util/test/group-list-item-common-test.js
+37
-0
No files found.
src/sidebar/util/group-list-item-common.js
0 → 100644
View file @
3676d7e1
'use strict'
;
function
orgName
(
group
)
{
return
group
.
organization
&&
group
.
organization
.
name
;
}
function
trackViewGroupActivity
(
analytics
)
{
analytics
.
track
(
analytics
.
events
.
GROUP_VIEW_ACTIVITY
);
}
module
.
exports
=
{
orgName
,
trackViewGroupActivity
,
};
src/sidebar/util/test/group-list-item-common-test.js
0 → 100644
View file @
3676d7e1
'use strict'
;
const
groupListItemCommon
=
require
(
'../group-list-item-common'
);
const
{
events
}
=
require
(
'../../services/analytics'
);
describe
(
'sidebar/util/groupListItemCommon'
,
()
=>
{
describe
(
'trackViewGroupActivity'
,
()
=>
{
it
(
'triggers the GROUP_VIEW_ACTIVITY event when called'
,
()
=>
{
const
fakeAnalytics
=
{
track
:
sinon
.
stub
(),
events
,
};
groupListItemCommon
.
trackViewGroupActivity
(
fakeAnalytics
);
assert
.
calledWith
(
fakeAnalytics
.
track
,
fakeAnalytics
.
events
.
GROUP_VIEW_ACTIVITY
);
});
});
describe
(
'orgName'
,
()
=>
{
it
(
'returns the organization name if it exists'
,
()
=>
{
const
fakeGroup
=
{
id
:
'groupid'
,
organization
:
{
name
:
'org'
}
};
const
organizationName
=
groupListItemCommon
.
orgName
(
fakeGroup
);
assert
.
equal
(
organizationName
,
fakeGroup
.
organization
.
name
);
});
it
(
'returns undefined if group has no organization'
,
()
=>
{
const
fakeGroup
=
{
id
:
'groupid'
};
assert
.
isUndefined
(
groupListItemCommon
.
orgName
(
fakeGroup
));
});
});
});
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