Files
openfoodnetwork/spec/javascripts/unit/darkswarm/controllers/sidebar_controller_spec.js.coffee
2014-03-20 16:58:57 +11:00

25 lines
632 B
CoffeeScript

describe "SidebarCtrl", ->
ctrl = null
scope = null
location = null
beforeEach ->
module("Darkswarm")
location =
path: ->
"/test"
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"
it 'is inactive no location is set', ->
scope.active_sidebar = null
expect(scope.active()).toEqual null