User can select a hub

This commit is contained in:
Rohan Mitchell
2014-11-20 10:29:48 +11:00
parent 912c60f720
commit 680ba379c1
4 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
describe "OverrideVariantsCtrl", ->
ctrl = null
scope = null
hubs = [{id: 1, name: 'Hub'}]
beforeEach ->
module 'ofn.admin'
scope = {}
inject ($controller)->
ctrl = $controller 'AdminOverrideVariantsCtrl', {$scope: scope, hubs: hubs}
it "initialises the hub list and the chosen hub", ->
expect(scope.hubs).toEqual hubs
expect(scope.hub).toBeNull
describe "selecting a hub", ->
it "sets the chosen hub", ->
scope.hub_id = 1
scope.selectHub()
expect(scope.hub).toEqual hubs[0]
it "does nothing when no selection has been made", ->
scope.hub_id = ''
scope.selectHub
expect(scope.hub).toBeNull