webogram-i2p/test/unit/controllers/AppFooterControllerSpec.js
Bart cd3979aeab Cleanup of tests, improved readability of the test code (#1434)
* Cleanup of tests, improved readability

* Improved readability concerning timeout/loading tests, removed unnecessary 'this.'
2017-06-28 18:03:49 +03:00

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()
})
})