cd3979aeab
* Cleanup of tests, improved readability * Improved readability concerning timeout/loading tests, removed unnecessary 'this.'
34 lines
862 B
JavaScript
34 lines
862 B
JavaScript
'use strict'
|
|
/* global describe, it, inject, expect, beforeEach */
|
|
|
|
describe('AppFooterController', function () {
|
|
beforeEach(module('myApp.controllers'))
|
|
|
|
beforeEach(function () {
|
|
this.LayoutSwitchService = {
|
|
serviceFlag: false,
|
|
switchLayout: function (parameter) {
|
|
this.serviceFlag = true
|
|
}
|
|
}
|
|
|
|
inject(function (_$controller_, _$rootScope_) {
|
|
this.$controller = _$controller_
|
|
|
|
this.$scope = _$rootScope_.$new()
|
|
this.$controller('AppFooterController', {
|
|
$scope: this.$scope,
|
|
LayoutSwitchService: this.LayoutSwitchService
|
|
})
|
|
})
|
|
})
|
|
|
|
// define tests
|
|
it('calls the right function', function (done) {
|
|
expect(this.LayoutSwitchService.serviceFlag).toBe(false)
|
|
this.$scope.switchLayout(true)
|
|
expect(this.LayoutSwitchService.serviceFlag).toBe(true)
|
|
done()
|
|
})
|
|
})
|