82957f1b91
* 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
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
'use strict'
|
|
/* global describe, it, inject, expect, beforeEach */
|
|
|
|
describe('myLangFooter directive', function () {
|
|
var $compile, $rootScope
|
|
|
|
beforeEach(module('ui.bootstrap'))
|
|
beforeEach(module('myApp.templates'))
|
|
// ErrorServiceProvider in myApp.services is needed by
|
|
// AppLangSelectController in myApp.controllers
|
|
beforeEach(module('myApp.services'))
|
|
beforeEach(module('myApp.controllers'))
|
|
beforeEach(module('myApp.directives'))
|
|
|
|
beforeEach(inject(function (_$compile_, _$rootScope_) {
|
|
$compile = _$compile_
|
|
$rootScope = _$rootScope_
|
|
}))
|
|
|
|
it('compiles a my-lang-footer attribute', function () {
|
|
var compiledElement = $compile('<div my-lang-footer></div>')($rootScope)
|
|
$rootScope.$digest() // Fire watchers
|
|
expect(compiledElement.html()).toContain('footer_lang_link')
|
|
expect(compiledElement.html()).toContain('AppLangSelectController')
|
|
})
|
|
|
|
it('compiles a my-lang-footer element', function () {
|
|
var compiledElement = $compile('<my-lang-footer></my-lang-footer>')($rootScope)
|
|
$rootScope.$digest() // Fire watchers
|
|
expect(compiledElement.html()).toContain('footer_lang_link')
|
|
expect(compiledElement.html()).toContain('AppLangSelectController')
|
|
})
|
|
})
|