webogram-i2p/test/unit/controllers/AppLangSelectControllerSpec.js
Bart 82957f1b91 Added structure to test directory, Fully tested filters.js (#1393)
* added tests for filter.js, Added structure to test-directory

In the gulpfile I changed some of the karma execution to ensure templates.js exists before the tests
Also removed some StandardJS errors from filters.js

* added tests to create at least 50% coverage for filters.js

* Added test for full coverage of filters.js

* fixed 2 side-cases

* Removed duplicate test, improved test-titles and added outcome clarification for dateOrTimeFilter

* Added test-init

While running ``gulp test`` there were a lot of warnings concerning i18n: key not found
This was because init.js was not run.
Because some parts of init.js were not relevant, I created test-init.js, only containing the part concerning localization.
Now the log is a lot cleaner when running ``gulp test``

* added 'use strict' to testing files

* changed local vars to this.

* improved clarity of mistery numbers

* improved in-test structure

* Improved shortUrl tests

* removed unnecessary code

* added cleanup to single test
2017-04-29 11:54:46 +03:00

54 lines
1.4 KiB
JavaScript

'use strict'
/* global describe, it, inject, expect, beforeEach, xit */
describe('AppLangSelectController', function () {
var $controller, $scope
beforeEach(module('ui.bootstrap'))
beforeEach(module('myApp.services'))
beforeEach(module('myApp.controllers'))
beforeEach(function () {
inject(function (_$controller_, _$rootScope_, _, Storage, ErrorService, AppRuntimeManager) {
$controller = _$controller_
$scope = _$rootScope_.$new()
$controller('AppLangSelectController', {
$scope: $scope,
_: _,
Storage: Storage,
ErrorService: ErrorService,
AppRuntimeManager: AppRuntimeManager
})
})
})
it('holds the supportedLocales', function () {
expect($scope.supportedLocales).toBeDefined()
})
it('holds langNames', function () {
expect($scope.langNames).toBeDefined()
})
it('holds the current locale', function () {
expect($scope.curLocale).toBeDefined()
})
it('has a locale form', function () {
expect($scope.form).toBeDefined()
expect($scope.form.locale).toBeDefined()
})
it('allows to select a locale', function () {
expect($scope.localeSelect).toBeDefined()
})
describe('when the user switches the locale', function () {
describe('and confirms the dialogue', function () {
xit('reloads the app', function (done) {
done()
})
})
})
})