diff --git a/awx/ui/client/lib/components/panel/body.partial.html b/awx/ui/client/lib/components/panel/body.partial.html index 371d08af3e..fa6c56e458 100644 --- a/awx/ui/client/lib/components/panel/body.partial.html +++ b/awx/ui/client/lib/components/panel/body.partial.html @@ -1,3 +1,3 @@
- +
diff --git a/awx/ui/client/test/index.js b/awx/ui/client/test/index.js index f54a6bef6a..40039e8c91 100644 --- a/awx/ui/client/test/index.js +++ b/awx/ui/client/test/index.js @@ -1,5 +1,11 @@ +// Import angular and angular-mocks to the global scope import 'angular'; import 'angular-mocks'; -import '../components'; -import './panel.spec'; +// Import custom Angular module dependencies +import '../src/i18n'; +import '../lib/services'; +import '../lib/components'; + +// Import tests +import './panel-body.spec'; diff --git a/awx/ui/client/test/karma.conf.js b/awx/ui/client/test/karma.conf.js index 591f7984b1..0baa1fdad9 100644 --- a/awx/ui/client/test/karma.conf.js +++ b/awx/ui/client/test/karma.conf.js @@ -11,7 +11,7 @@ module.exports = config => { reporters: ['progress'], files: [ './index.js', - '../components/**/*.html' + '../lib/components/**/*.html' ], plugins: [ 'karma-webpack', @@ -20,14 +20,15 @@ module.exports = config => { 'karma-ng-html2js-preprocessor' ], preprocessors: { - '../components/**/*.html': 'ng-html2js', - '../components/index.js': 'webpack', + '../lib/components/**/*.html': 'ng-html2js', './index.js': 'webpack' }, ngHtml2JsPreprocessor: { moduleName: 'at.test.templates', - stripPrefix: path.resolve(__dirname, '..'), - prependPrefix: 'static/partials' + cacheIdFromPath: function (filepath) { + filepath = filepath.replace(path.join(__dirname, '../lib'), ''); + return '/static/partials' + filepath; + } }, webpack: { module: { @@ -36,7 +37,12 @@ module.exports = config => { test: /\.js$/, loader: 'babel', exclude: /node_modules/ - } + }, + { + test: /\.json$/, + loader: 'json', + exclude: /node_modules/ + }, ] } }, diff --git a/awx/ui/client/test/panel-body.spec.js b/awx/ui/client/test/panel-body.spec.js new file mode 100644 index 0000000000..29a9c0af71 --- /dev/null +++ b/awx/ui/client/test/panel-body.spec.js @@ -0,0 +1,24 @@ +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('yo')($rootScope); + $rootScope.$digest(); + + expect(element.hasClass('at-Panel-body')).toBe(true); + expect(element.html()).toContain('yo'); + }); +}); diff --git a/awx/ui/client/test/panel.spec.js b/awx/ui/client/test/panel.spec.js deleted file mode 100644 index eeafa0d5a5..0000000000 --- a/awx/ui/client/test/panel.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -describe('Components | panel', () => { - - let $compile; - let $rootScope; - - beforeEach(done => { - angular.mock.module('at.components') - angular.mock.module('at.test.templates'); - - inject((_$compile_, _$rootScope_) => { - $compile = _$compile_; - $rootScope = _$rootScope_; - done(); - }); - }); - - it('should load the navigation partial', function() { - var element = $compile('')($rootScope); - $rootScope.$digest(); - - expect(element.html()).toContain('at-Panel'); - }); });