2017-04-29 10:54:46 +02:00
|
|
|
'use strict'
|
2017-03-13 19:57:11 +01:00
|
|
|
/* global describe, it, inject, expect, beforeEach */
|
|
|
|
|
|
|
|
describe('AppFooterController', function () {
|
|
|
|
var $controller, $scope, service, serviceFlag
|
|
|
|
|
|
|
|
beforeEach(module('myApp.controllers'))
|
|
|
|
|
|
|
|
beforeEach(function () {
|
|
|
|
serviceFlag = false
|
|
|
|
service = {
|
|
|
|
switchLayout: function (parameter) {
|
|
|
|
serviceFlag = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inject(function (_$controller_, _$rootScope_) {
|
|
|
|
$controller = _$controller_
|
|
|
|
|
|
|
|
$scope = _$rootScope_.$new()
|
|
|
|
$controller('AppFooterController', {
|
|
|
|
$scope: $scope,
|
|
|
|
LayoutSwitchService: service
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
// define tests
|
|
|
|
it('calls the right function', function (done) {
|
|
|
|
expect(serviceFlag).toBe(false)
|
|
|
|
$scope.switchLayout(null)
|
|
|
|
expect(serviceFlag).toBe(true)
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|