From 13c3f884040a7a5a79ab88d576a508d534c694a9 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Thu, 30 Oct 2014 21:13:57 +1000 Subject: [PATCH] Finished upgrading dependencies. Karma modified so that only vendor files are referenced from the build directory. Karma config moved to buildConfig/. Unit tests were added for the automated vendor services/ Also fixed a bug that has broken audio download links. --- Gruntfile.js | 8 +-- {karma => buildConfig}/karma-unit.tpl.js | 11 +++- src/app/app.spec.js | 4 -- src/app/listen/listen.tpl.html | 12 ++--- .../services/vendorServices/externals.spec.js | 50 +++++++++++++++++++ 5 files changed, 70 insertions(+), 15 deletions(-) rename {karma => buildConfig}/karma-unit.tpl.js (84%) create mode 100644 src/components/services/vendorServices/externals.spec.js diff --git a/Gruntfile.js b/Gruntfile.js index efc871bf..075a8f9f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -788,19 +788,21 @@ module.exports = function (grunt) { /** * In order to avoid having to specify manually the files needed for karma to - * run, we use grunt to manage the list for us. The `karma/*` files are + * run, we use grunt to manage the list for us. The `buildConfig/karma-unit.tpl.js` files are * compiled as grunt templates for use by Karma. Yay! */ grunt.registerMultiTask('karmaconfig', 'Process karma config templates', function () { var jsFiles = filterForJS(this.filesSrc); var usePhantomJs = grunt.config('usePhantomJs'); + var vendorFiles = grunt.config("vendor_files.js"); - grunt.file.copy('karma/karma-unit.tpl.js', grunt.config('build_dir') + '/karma-unit.js', { + grunt.file.copy('buildConfig/karma-unit.tpl.js', grunt.config('build_dir') + '/karma-unit.js', { process: function (contents, path) { return grunt.template.process(contents, { data: { usePhantomJs: usePhantomJs, - scripts: jsFiles + scripts: jsFiles, + vendorFiles: vendorFiles, } }); } diff --git a/karma/karma-unit.tpl.js b/buildConfig/karma-unit.tpl.js similarity index 84% rename from karma/karma-unit.tpl.js rename to buildConfig/karma-unit.tpl.js index 5ebee3d8..dd73f290 100644 --- a/karma/karma-unit.tpl.js +++ b/buildConfig/karma-unit.tpl.js @@ -1,6 +1,7 @@ module.exports = function (config) { var fileJson = '[<% scripts.forEach( function ( file, index, array ) { %>"<%= file %>"<%= index == array.length - 1 ? "": ","%> <% }); %>]', + vendorJson = '[<% vendorFiles.forEach( function ( file, index, array ) { %>"<%= file %>"<%= index == array.length - 1 ? "": ","%> <% }); %>]', browserToUse = "<%= usePhantomJs ? 'PhantomJS' : 'Chrome' %>", useLineCov = "<%= usePhantomJs %>" === "true"; @@ -12,7 +13,7 @@ module.exports = function (config) { /** * From where to look for files, starting with the location of this file. */ - configObject.basePath = '../build'; + configObject.basePath = '../'; /** * This is the list of file patterns to load into the browser during testing. @@ -22,9 +23,15 @@ module.exports = function (config) { "vendor/jasmine-expect/dist/jasmine-matchers.js" ].concat(JSON.parse(fileJson).concat([ 'src/**/*.js', - '../src/**/*.spec.js' + 'src/**/*.spec.js' ])); + // HACK!: use vendor files out of the build directory since they undergo a transform on build + var transformedVendorFiles = JSON.parse(vendorJson); + configObject.files = configObject.files.map(function (value) { + return transformedVendorFiles.indexOf(value) >= 0 ? "build/" + value : value; + }); + configObject.exclude = [ 'src/assets/**/*.js' ]; diff --git a/src/app/app.spec.js b/src/app/app.spec.js index 21d1acfe..ac9a3630 100644 --- a/src/app/app.spec.js +++ b/src/app/app.spec.js @@ -3,8 +3,4 @@ describe('AppCtrl', function() { it('should pass a dummy test', function() { expect(true).toBeTruthy(); }); - - it("checks bowser is on the global scope", function() { - expect(window.bowser).toBeDefined(); - }); }); \ No newline at end of file diff --git a/src/app/listen/listen.tpl.html b/src/app/listen/listen.tpl.html index f671bc28..77f5882e 100644 --- a/src/app/listen/listen.tpl.html +++ b/src/app/listen/listen.tpl.html @@ -216,14 +216,14 @@

ng-href="{{model.media.spectrogram.url}}" title="Download the spectrogram">Spectrogram |  Audio (WAV) |  Audio (MP3) |