Fix karma config and remove karma-ng-html2js-preprocessor

This commit is contained in:
Marliana Lara 2017-10-02 14:57:45 -04:00
parent 2f8155763b
commit e19b4e0c8c
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
5 changed files with 9 additions and 48 deletions

View File

@ -5,7 +5,7 @@ let $document;
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
$(document).on('click', (e) => {
$document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav');
}

View File

@ -1,15 +1,7 @@
// Import angular and angular-mocks to the global scope
import 'angular';
import 'angular-mocks';
// Import custom Angular module dependencies
import '../../src/i18n';
import '../../lib/services';
import '../../lib/components';
import '../../lib/models';
// Import tests
import './panel-body.spec';
import './layout.spec';
import './side-nav.spec';
import './side-nav-item.spec';

View File

@ -1,4 +1,3 @@
let path = require('path');
const webpackConfig = require('../../../build/webpack.test.js');
module.exports = config => {
@ -11,31 +10,26 @@ module.exports = config => {
browsers: ['PhantomJS'],
reporters: ['progress'],
files: [
'./index.js',
'../../../client/src/vendor.js',
'../../../client/src/app.js',
'../../lib/components/**/*.html'
'../../../client/src/**/*.html',
'./index.js',
],
plugins: [
'karma-webpack',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-ng-html2js-preprocessor'
'karma-html2js-preprocessor'
],
preprocessors: {
'./index.js': 'webpack',
'../../../client/src/vendor.js': 'webpack',
'../../../client/src/app.js': 'webpack',
'../../lib/components/**/*.html': 'ng-html2js'
},
ngHtml2JsPreprocessor: {
moduleName: 'at.test.templates',
cacheIdFromPath: function (filepath) {
filepath = filepath.replace(path.join(__dirname, '../../lib'), '');
return '/static/partials' + filepath;
}
'../../../client/src/**/*.html': 'html2js',
'./index.js': 'webpack'
},
webpack: webpackConfig,
webpackMiddleware: {
noInfo: 'errors-only'
}
});
};
};

View File

@ -1,24 +0,0 @@
describe('Components | panel/body', () => {
let $compile;
let $rootScope;
beforeEach(() => {
angular.mock.module('at.lib.services')
angular.mock.module('at.lib.components')
angular.mock.module('at.test.templates');
});
beforeEach(angular.mock.inject((_$compile_, _$rootScope_) => {
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
it('Should produce at-Panel-body HTML content', () => {
let element = $compile('<at-panel-body>yo</at-panel-body>')($rootScope);
$rootScope.$digest();
expect(element.hasClass('at-Panel-body')).toBe(true);
expect(element.html()).toContain('yo');
});
});

View File

@ -70,7 +70,6 @@
"karma-html2js-preprocessor": "^1.0.0",
"karma-jasmine": "^1.1.0",
"karma-junit-reporter": "^1.2.0",
"karma-ng-html2js-preprocessor": "^1.0.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.4",