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