Commit 2200835d authored by Sean Hammond's avatar Sean Hammond

Add test for route reload on group change

parent 89f2b668
...@@ -12,6 +12,7 @@ describe 'AppController', -> ...@@ -12,6 +12,7 @@ describe 'AppController', ->
fakeParams = null fakeParams = null
fakeSession = null fakeSession = null
fakeGroups = null fakeGroups = null
fakeRoute = null
sandbox = null sandbox = null
...@@ -20,7 +21,7 @@ describe 'AppController', -> ...@@ -20,7 +21,7 @@ describe 'AppController', ->
$controller('AppController', locals) $controller('AppController', locals)
before -> before ->
angular.module('h', ['ngRoute']) angular.module('h')
.controller('AppController', require('../app-controller')) .controller('AppController', require('../app-controller'))
.controller('AnnotationUIController', angular.noop) .controller('AnnotationUIController', angular.noop)
...@@ -65,6 +66,8 @@ describe 'AppController', -> ...@@ -65,6 +66,8 @@ describe 'AppController', ->
fakeGroups = {focus: ->} fakeGroups = {focus: ->}
fakeRoute = {reload: sandbox.spy()}
$provide.value 'annotationUI', fakeAnnotationUI $provide.value 'annotationUI', fakeAnnotationUI
$provide.value 'auth', fakeAuth $provide.value 'auth', fakeAuth
$provide.value 'drafts', fakeDrafts $provide.value 'drafts', fakeDrafts
...@@ -72,6 +75,7 @@ describe 'AppController', -> ...@@ -72,6 +75,7 @@ describe 'AppController', ->
$provide.value 'identity', fakeIdentity $provide.value 'identity', fakeIdentity
$provide.value 'session', fakeSession $provide.value 'session', fakeSession
$provide.value 'groups', fakeGroups $provide.value 'groups', fakeGroups
$provide.value '$route', fakeRoute
$provide.value '$location', fakeLocation $provide.value '$location', fakeLocation
$provide.value '$routeParams', fakeParams $provide.value '$routeParams', fakeParams
return return
...@@ -126,3 +130,8 @@ describe 'AppController', -> ...@@ -126,3 +130,8 @@ describe 'AppController', ->
it 'does not show the share dialog at start', -> it 'does not show the share dialog at start', ->
createController() createController()
assert.isFalse($scope.shareDialog.visible) assert.isFalse($scope.shareDialog.visible)
it 'Calls $route.reload() when the focused group changes', ->
createController()
$scope.$broadcast('groupFocused')
assert.calledOnce(fakeRoute.reload)
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