Reworking the way the Sidebar works

This commit is contained in:
Will Marshall
2014-03-24 14:25:44 +11:00
parent 93db813b3a
commit 0690fcda48
9 changed files with 37 additions and 29 deletions

View File

@@ -6,19 +6,17 @@ describe "SidebarCtrl", ->
beforeEach ->
module("Darkswarm")
location =
path: ->
"/test"
hash: ->
"sidebar"
inject ($controller, $rootScope) ->
scope = $rootScope
ctrl = $controller 'SidebarCtrl', {$scope: scope, $location: location}
scope.$apply()
it 'tracks the active sidebar from the $location', ->
expect(scope.active_sidebar).toEqual "/test"
it 'is active when a location is set', ->
expect(scope.active()).toEqual "active"
expect(scope.active()).toEqual true
it 'is inactive no location is set', ->
scope.active_sidebar = null
expect(scope.active()).toEqual null
location.hash = ->
null
expect(scope.active()).toEqual false