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
313754ec
Commit
313754ec
authored
Jul 22, 2015
by
Nick Stenning
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2300 from hypothesis/nipsa
Add support for flagging user accounts as "not in public site areas"
parents
d5411690
a2040d37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
16 deletions
+46
-16
annotation-viewer-controller.coffee
h/static/scripts/annotation-viewer-controller.coffee
+2
-2
annotation-viewer-controller-test.coffee
...tic/scripts/test/annotation-viewer-controller-test.coffee
+44
-14
No files found.
h/static/scripts/annotation-viewer-controller.coffee
View file @
313754ec
...
...
@@ -24,8 +24,8 @@ module.exports = class AnnotationViewerController
$location
.
path
(
'/stream'
).
search
(
'q'
,
query
)
id
=
$routeParams
.
id
store
.
SearchResource
.
get
_id
:
id
,
({
rows
}
)
->
annotationMapper
.
loadAnnotations
(
rows
)
store
.
AnnotationResource
.
read
id
:
id
,
(
annotation
)
->
annotationMapper
.
loadAnnotations
(
[
annotation
]
)
$scope
.
threadRoot
=
children
:
[
$scope
.
threading
.
getContainer
(
id
)]
store
.
SearchResource
.
get
references
:
id
,
({
rows
})
->
annotationMapper
.
loadAnnotations
(
rows
)
...
...
h/static/scripts/test/annotation-viewer-controller-test.coffee
View file @
313754ec
{
module
,
inject
}
=
require
(
'angular-mock'
)
{
inject
,
module
}
=
require
(
'angular-mock'
)
assert
=
chai
.
assert
sinon
.
assert
.
expose
assert
,
prefix
:
null
describe
'AnnotationViewerController'
,
->
annotationViewerController
=
null
describe
"AnnotationViewerController"
,
->
before
->
angular
.
module
(
'h'
,
[
'ngRoute'
])
.
controller
(
'AnnotationViewerController'
,
require
(
'../annotation-viewer-controller'
))
angular
.
module
(
"h"
,
[])
.
controller
(
'AnnotationViewerController'
,
require
(
'../annotation-viewer-controller'
))
beforeEach
(
module
(
"h"
))
# Return the $controller service from Angular.
getControllerService
=
->
$controller
=
null
inject
((
_$controller_
)
->
$controller
=
_$controller_
)
return
$controller
# Return a new AnnotationViewerController instance.
createAnnotationViewerController
=
({
$location
,
$routeParams
,
$scope
,
streamer
,
store
,
streamFilter
,
annotationMapper
})
->
locals
=
{
$location
:
$location
or
{}
$routeParams
:
$routeParams
or
{
id
:
"test_annotation_id"
}
$scope
:
$scope
or
{
search
:
{}}
streamer
:
streamer
or
{
send
:
->
}
store
:
store
or
{
AnnotationResource
:
{
read
:
sinon
.
spy
()},
SearchResource
:
{
get
:
->
}}
streamFilter
:
streamFilter
or
{
setMatchPolicyIncludeAny
:
->
{
addClause
:
->
{
addClause
:
->
}}
getFilter
:
->
}
annotationMapper
:
annotationMapper
or
{
loadAnnotations
:
sinon
.
spy
()}
}
locals
[
"ctrl"
]
=
getControllerService
()(
"AnnotationViewerController"
,
locals
)
return
locals
beforeEach
inject
(
$controller
,
$rootScope
)
->
$scope
=
$rootScope
.
$new
()
$scope
.
search
=
{}
annotationViewerController
=
$controller
'AnnotationViewerController'
,
$scope
:
$scope
it
"sets the isEmbedded property to false"
,
->
{
$scope
}
=
createAnnotationViewerController
({})
assert
.
isFalse
(
$scope
.
isEmbedded
)
it
'sets the isEmbedded property to false'
,
->
assert
.
isFalse
(
$scope
.
isEmbedded
)
it
"calls the annotation API to get the annotation"
,
->
{
store
}
=
createAnnotationViewerController
({})
assert
store
.
AnnotationResource
.
read
.
args
[
0
][
0
].
id
==
"test_annotation_id"
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