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
b7068aca
Commit
b7068aca
authored
Nov 05, 2018
by
Hannah Stepanek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for showGroupMenu
parent
dfcb10be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
group-list-test.js
src/sidebar/components/test/group-list-test.js
+85
-0
No files found.
src/sidebar/components/test/group-list-test.js
View file @
b7068aca
...
@@ -332,4 +332,89 @@ describe('groupList', function () {
...
@@ -332,4 +332,89 @@ describe('groupList', function () {
assert
.
calledWith
(
$window
.
open
,
'https://test.hypothes.is/groups/new'
,
assert
.
calledWith
(
$window
.
open
,
'https://test.hypothes.is/groups/new'
,
'_blank'
);
'_blank'
);
});
});
describe
(
'group menu visibility'
,
()
=>
{
it
(
'is hidden when third party service and only one group'
,
function
()
{
// Configure third party service.
fakeSettings
.
authDomain
=
'example.com'
;
fakeSettings
.
services
=
[{
authority
:
'publisher.org'
,
}];
// Configure only one group.
const
group
=
[{
id
:
'h-devs'
,
links
:
{
html
:
PRIVATE_GROUP_LINK
,
},
name
:
'Hypothesis Developers'
,
organization
:
groupFixtures
.
defaultOrganization
(),
type
:
'private'
,
}];
fakeGroups
.
all
=
()
=>
{
return
group
;
};
const
element
=
createGroupList
();
const
showGroupsMenu
=
element
.
ctrl
.
showGroupsMenu
();
const
dropdownToggle
=
element
.
find
(
'.dropdown-toggle'
);
const
arrowIcon
=
element
.
find
(
'.h-icon-arrow-drop-down'
);
const
dropdownMenu
=
element
.
find
(
'.dropdown-menu__top-arrow'
);
const
dropdownOptions
=
element
.
find
(
'.dropdown-menu__row '
);
assert
.
isFalse
(
showGroupsMenu
);
assert
.
lengthOf
(
dropdownToggle
,
0
);
assert
.
lengthOf
(
arrowIcon
,
0
);
assert
.
lengthOf
(
dropdownMenu
,
0
);
assert
.
lengthOf
(
dropdownOptions
,
0
);
});
it
(
'is shown when there is more than one group'
,
function
()
{
// Configure third party service.
fakeSettings
.
authDomain
=
'example.com'
;
fakeSettings
.
services
=
[{
authority
:
'publisher.org'
,
}];
const
element
=
createGroupList
();
const
showGroupsMenu
=
element
.
ctrl
.
showGroupsMenu
();
const
dropdownToggle
=
element
.
find
(
'.dropdown-toggle'
);
const
arrowIcon
=
element
.
find
(
'.h-icon-arrow-drop-down'
);
const
dropdownMenu
=
element
.
find
(
'.dropdown-menu__top-arrow'
);
const
dropdownOptions
=
element
.
find
(
'.dropdown-menu__row '
);
assert
.
isTrue
(
showGroupsMenu
);
assert
.
lengthOf
(
dropdownToggle
,
1
);
assert
.
lengthOf
(
arrowIcon
,
1
);
assert
.
lengthOf
(
dropdownMenu
,
1
);
assert
.
lengthOf
(
dropdownOptions
,
4
);
});
it
(
'is shown when it is not a thirdparty service'
,
function
()
{
// Configure only one group.
const
group
=
[{
id
:
'h-devs'
,
links
:
{
html
:
PRIVATE_GROUP_LINK
,
},
name
:
'Hypothesis Developers'
,
organization
:
groupFixtures
.
defaultOrganization
(),
type
:
'private'
,
}];
fakeGroups
.
all
=
()
=>
{
return
group
;
};
const
element
=
createGroupList
();
const
showGroupsMenu
=
element
.
ctrl
.
showGroupsMenu
();
const
dropdownToggle
=
element
.
find
(
'.dropdown-toggle'
);
const
arrowIcon
=
element
.
find
(
'.h-icon-arrow-drop-down'
);
const
dropdownMenu
=
element
.
find
(
'.dropdown-menu__top-arrow'
);
const
dropdownOptions
=
element
.
find
(
'.dropdown-menu__row '
);
assert
.
isTrue
(
showGroupsMenu
);
assert
.
lengthOf
(
dropdownToggle
,
1
);
assert
.
lengthOf
(
arrowIcon
,
1
);
assert
.
lengthOf
(
dropdownMenu
,
1
);
assert
.
lengthOf
(
dropdownOptions
,
2
);
});
});
});
});
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