diff --git a/bower.json b/bower.json
index fdd5c73b..64622bdb 100644
--- a/bower.json
+++ b/bower.json
@@ -49,6 +49,6 @@
"bootstrap": "~3.2.0"
},
"devDependencies": {
- "angular-mocks": "~1.2.22"
+ "angular-mocks": "~1.3.0-beta.18"
}
}
diff --git a/res/app/components/stf/common-ui/clear-button/clear-button-spec.js b/res/app/components/stf/common-ui/clear-button/clear-button-spec.js
index f918d89f..6fc6c6f7 100644
--- a/res/app/components/stf/common-ui/clear-button/clear-button-spec.js
+++ b/res/app/components/stf/common-ui/clear-button/clear-button-spec.js
@@ -1,23 +1,22 @@
describe('clearButton', function () {
- beforeEach(module('stf.clear-button'));
+ beforeEach(angular.mock.module(require('./').name))
- var scope, compile;
+ var scope, compile
beforeEach(inject(function ($rootScope, $compile) {
- scope = $rootScope.$new();
- compile = $compile;
- }));
+ scope = $rootScope.$new()
+ compile = $compile
+ }))
- it('should ...', function () {
+ it('should display a text label', function () {
+ var element = compile('')(scope)
+ expect(element.find('span').text()).toBe('Clear')
+ })
- /*
- To test your directive, you need to create some html that would use your
- directive, send that through compile() then compare the results.
+ it('should display a trash icon', function () {
+ var element = compile('')(scope)
+ expect(element.find('i')[0].getAttribute('class')).toMatch('fa-trash-o')
+ })
- var element = compile('
hi
')(scope);
- expect(element.text()).toBe('hello, world');
- */
-
- });
-});
+})
diff --git a/res/test/helpers/helper.js b/res/test/helpers/helper.js
new file mode 100644
index 00000000..8f2f9eda
--- /dev/null
+++ b/res/test/helpers/helper.js
@@ -0,0 +1,2 @@
+require('angular')
+require('angular-mocks')
diff --git a/res/test/karma.conf.js b/res/test/karma.conf.js
index 9180262a..d2951a9b 100644
--- a/res/test/karma.conf.js
+++ b/res/test/karma.conf.js
@@ -1,28 +1,45 @@
+var _ = require('lodash')
+var webpackConfig = require('./../../webpack.config')
+
+var webpack = require('webpack')
+
module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
files: [
- //'test/*Test.*'
- '../app/*-test.js'
-// '../app/**/*.js'
+ 'helpers/**/*.js',
+ '../app/**/*-spec.js',
+// '../app/components/stf/common-ui/clear-button/*-spec.js'
],
+
+ preprocessors: {
+ 'helpers/**/*.js': ['webpack'],
+ '../app/**/*.js': ['webpack']
+ },
exclude: [
],
- preprocessors: {
-// '../app/**/*.js': ['webpack']
- '../app/*-test.js': ['webpack']
- },
+// webpack: webpackConfig.webpack,
webpack: {
+ entry: {
+ app: '../app/app.js'
+ },
cache: true,
- module: {
- loaders: [
-// { test: /\.coffee$/, loader: 'coffee-loader' }
- ]
- }
+ module: webpackConfig.webpack.module,
+ resolve: webpackConfig.webpack.resolve,
+ plugins: [
+ new webpack.ResolverPlugin(
+ new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(
+ 'bower.json'
+ , ['main']
+ )
+ )
+ ]
},
webpackServer: {
+ debug: true,
+ devtool: 'eval',
stats: false
// stats: {
// colors: true