Commit 313754ec authored by Nick Stenning's avatar Nick Stenning

Merge pull request #2300 from hypothesis/nipsa

Add support for flagging user accounts as "not in public site areas"
parents d5411690 a2040d37
......@@ -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)
......
{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"))
beforeEach inject ($controller, $rootScope) ->
$scope = $rootScope.$new()
$scope.search = {}
annotationViewerController = $controller 'AnnotationViewerController',
$scope: $scope
# Return the $controller service from Angular.
getControllerService = ->
$controller = null
inject((_$controller_) ->
$controller = _$controller_
)
return $controller
it 'sets the isEmbedded property to false', ->
# 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
it "sets the isEmbedded property to false", ->
{$scope} = createAnnotationViewerController({})
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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment