From 41ea74dca5f991c9f28658b5bdef677b2d1dc237 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Tue, 12 Nov 2013 14:01:09 +0100 Subject: [PATCH] Fixed JSLint to work with karma now. Some JSLint errors still occur --- .../system/aardvark/test/karma/karma.conf.js | 185 ++++++++++++++++++ .../aardvark/test/karma/karma.conf.js.bkp | 185 ++++++++++++++++++ .../aardvark/test/specJSLint/jsLintSpec.js | 130 ++++++------ .../specs/views/.collectionViewSpec.js.swp | Bin 0 -> 12288 bytes .../specs/views/.dbSelectionViewSpec.js.swp | Bin 0 -> 12288 bytes .../test/specs/views/.foxxEditViewSpec.js.swp | Bin 0 -> 12288 bytes .../test/specs/views/aboutViewSpec.js | 33 ---- .../test/specs/views/collectionViewSpec.js | 66 ++++--- .../test/specs/views/collectionsViewSpec.js | 12 +- .../test/specs/views/dbSelectionViewSpec.js | 85 ++++++++ .../test/specs/views/foxxEditViewSpec.js | 123 ++++++++++++ .../test/specs/views/graphViewSpec.js | 20 ++ 12 files changed, 707 insertions(+), 132 deletions(-) create mode 100644 js/apps/system/aardvark/test/karma/karma.conf.js create mode 100644 js/apps/system/aardvark/test/karma/karma.conf.js.bkp create mode 100644 js/apps/system/aardvark/test/specs/views/.collectionViewSpec.js.swp create mode 100644 js/apps/system/aardvark/test/specs/views/.dbSelectionViewSpec.js.swp create mode 100644 js/apps/system/aardvark/test/specs/views/.foxxEditViewSpec.js.swp delete mode 100644 js/apps/system/aardvark/test/specs/views/aboutViewSpec.js create mode 100644 js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js create mode 100644 js/apps/system/aardvark/test/specs/views/foxxEditViewSpec.js create mode 100644 js/apps/system/aardvark/test/specs/views/graphViewSpec.js diff --git a/js/apps/system/aardvark/test/karma/karma.conf.js b/js/apps/system/aardvark/test/karma/karma.conf.js new file mode 100644 index 0000000000..6d4aaab61e --- /dev/null +++ b/js/apps/system/aardvark/test/karma/karma.conf.js @@ -0,0 +1,185 @@ +// Karma configuration +// Generated on Thu Jul 04 2013 11:39:34 GMT+0200 (CEST) + +module.exports = function(karma) { + karma.set({ + + // base path, that will be used to resolve files and exclude + basePath: '../../', + + + // frameworks to use + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'test/lib/jasmine-1.3.1/jasmine-html.js', + 'test/lib/jslint.js', + + 'frontend/js/lib/jquery-1.8.3.js', + 'frontend/js/lib/jquery-ui-1.9.2.custom.js', + 'frontend/js/lib/jquery.dataTables.js', + 'frontend/js/lib/jquery.autogrow.js', + 'frontend/js/lib/jquery.jeditable.js', + 'frontend/js/lib/jquery.jeditable.autogrow.js', + 'frontend/js/lib/jquery.snippet.js', + 'frontend/js/lib/jquery.gritter.js', + 'frontend/js/lib/jquery.slideto.min.js', + 'frontend/js/lib/jquery.wiggle.min.js', + 'frontend/js/lib/jquery.ba-bbq.min.js', + 'frontend/js/lib/handlebars-1.0.rc.1.js', + 'frontend/js/lib/underscore.js', + 'frontend/js/lib/backbone.js', + 'frontend/js/lib/d3.v3.js', + 'frontend/js/lib/nv.d3.js', + 'frontend/js/lib/d3.fisheye.js', + 'frontend/js/lib/ejs_0.9_alpha_1_production.js', + 'frontend/js/lib/ColVis.js', + 'frontend/js/lib/bootstrap.js', + 'frontend/js/lib/bootstrap-pagination.js', + 'frontend/src/ace.js', + 'frontend/js/lib/jqconsole.min.js', + 'frontend/js/lib/splitter.js', + 'frontend/js/lib/swagger.js', + 'frontend/js/lib/swagger-ui.js', + 'frontend/js/lib/highlight.7.3.pack.js', + + // arangodb + 'frontend/js/arango/arango.js', + 'frontend/js/arango/templateEngine.js', + 'frontend/js/shell/browser.js', + 'frontend/js/modules/org/arangodb/arango-collection-common.js', + 'frontend/js/modules/org/arangodb/arango-collection.js', + 'frontend/js/modules/org/arangodb/arango-database.js', + 'frontend/js/modules/org/arangodb/arango-query-cursor.js', + 'frontend/js/modules/org/arangodb/arango-statement-common.js', + 'frontend/js/modules/org/arangodb/arango-statement.js', + 'frontend/js/modules/org/arangodb/arangosh.js', + 'frontend/js/modules/org/arangodb/graph-common.js', + 'frontend/js/modules/org/arangodb/graph.js', + 'frontend/js/modules/org/arangodb/mimetypes.js', + 'frontend/js/modules/org/arangodb/simple-query-common.js', + 'frontend/js/modules/org/arangodb/simple-query.js', + 'frontend/js/modules/org/arangodb/aql/functions.js', + 'frontend/js/modules/org/arangodb/graph/traversal.js', + 'frontend/js/modules/org/arangodb-common.js', + 'frontend/js/modules/org/arangodb.js', + 'frontend/js/bootstrap/errors.js', + 'frontend/js/bootstrap/monkeypatches.js', + 'frontend/js/bootstrap/module-internal.js', + 'frontend/js/client/bootstrap/module-internal.js', + 'frontend/js/client/client.js', + + // Mocks + 'test/mocks/disableEJS.js', + + // Models + 'frontend/js/models/arangoCollection.js', + 'frontend/js/models/arangoDatabase.js', + 'frontend/js/models/arangoDocument.js', + 'frontend/js/models/arangoLog.js', + 'frontend/js/models/arangoStatistics.js', + 'frontend/js/models/arangoStatisticsDescription.js', + 'frontend/js/models/foxx.js', + + // Collections + 'frontend/js/collections/arangoCollections.js', + 'frontend/js/collections/arangoDocuments.js', + 'frontend/js/collections/arangoDocument.js', + 'frontend/js/collections/arangoDatabase.js', + 'frontend/js/collections/arangoLogs.js', + 'frontend/js/collections/arangoStatisticsCollection.js', + 'frontend/js/collections/arangoStatisticsDescriptionCollection.js', + 'frontend/js/collections/foxxCollection.js', + + // Views + 'frontend/js/views/navigationView.js', + 'frontend/js/views/footerView.js', + 'frontend/js/views/queryView.js', + 'frontend/js/views/shellView.js', + 'frontend/js/views/dashboardView.js', + 'frontend/js/views/collectionsView.js', + 'frontend/js/views/collectionView.js', + 'frontend/js/views/newCollectionView.js', + 'frontend/js/views/collectionsItemView.js', + 'frontend/js/views/documentsView.js', + 'frontend/js/views/documentView.js', + 'frontend/js/views/documentSourceView.js', + 'frontend/js/views/logsView.js', + 'frontend/js/views/foxxActiveView.js', + 'frontend/js/views/foxxActiveListView.js', + 'frontend/js/views/foxxInstalledView.js', + 'frontend/js/views/foxxInstalledListView.js', + 'frontend/js/views/foxxEditView.js', + 'frontend/js/views/foxxMountView.js', + 'frontend/js/views/appDocumentationView.js', + 'frontend/js/views/graphView.js', + 'frontend/js/views/dbSelectionView.js', + + //Templates + {pattern: 'frontend/js/templates/*.ejs', served:true, included:false, watched: true}, + + // Specs + 'test/specs/arango/arangoSpec.js', + 'test/specs/views/collectionViewSpec.js', + 'test/specs/views/collectionsViewSpec.js', + 'test/specs/views/foxxEditViewSpec.js', + 'test/specs/views/dbSelectionViewSpec.js', + 'test/specs/views/graphViewSpec.js', + 'test/specJSLint/jsLintSpec.js' + ], + + + // list of files to exclude + exclude: [ + + ], + + + // test results reporter to use + // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' + reporters: ['progress'], + + + // web server port + port: 9876, + + + // cli runner port + runnerPort: 9100, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG + logLevel: karma.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers: [], + + + // If browser does not capture in given timeout [ms], kill it + captureTimeout: 60000, + + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false + }); +}; diff --git a/js/apps/system/aardvark/test/karma/karma.conf.js.bkp b/js/apps/system/aardvark/test/karma/karma.conf.js.bkp new file mode 100644 index 0000000000..22c5a2fa35 --- /dev/null +++ b/js/apps/system/aardvark/test/karma/karma.conf.js.bkp @@ -0,0 +1,185 @@ +// Karma configuration +// Generated on Thu Jul 04 2013 11:39:34 GMT+0200 (CEST) + +module.exports = function(karma) { + karma.set({ + + // base path, that will be used to resolve files and exclude + basePath: '../../', + + + // frameworks to use + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'frontend/js/lib/jquery-1.8.3.js', + 'frontend/js/lib/jquery-ui-1.9.2.custom.js', + 'frontend/js/lib/jquery.dataTables.js', + 'frontend/js/lib/jquery.autogrow.js', + 'frontend/js/lib/jquery.jeditable.js', + 'frontend/js/lib/jquery.jeditable.autogrow.js', + 'frontend/js/lib/jquery.snippet.js', + 'frontend/js/lib/jquery.gritter.js', + 'frontend/js/lib/jquery.slideto.min.js', + 'frontend/js/lib/jquery.wiggle.min.js', + 'frontend/js/lib/jquery.ba-bbq.min.js', + 'frontend/js/lib/handlebars-1.0.rc.1.js', + 'frontend/js/lib/underscore.js', + 'frontend/js/lib/backbone.js', + 'frontend/js/lib/d3.v3.js', + 'frontend/js/lib/nv.d3.js', + 'frontend/js/lib/d3.fisheye.js', + 'frontend/js/lib/ejs_0.9_alpha_1_production.js', + 'frontend/js/lib/ejs_fulljslint.js', + 'frontend/js/lib/ColVis.js', + 'frontend/js/lib/bootstrap.js', + 'frontend/js/lib/bootstrap-pagination.js', + 'frontend/src/ace.js', + 'frontend/js/lib/jqconsole.min.js', + 'frontend/js/lib/splitter.js', + 'frontend/js/lib/swagger.js', + 'frontend/js/lib/swagger-ui.js', + 'frontend/js/lib/highlight.7.3.pack.js', + + // arangodb + 'frontend/js/arango/arango.js', + 'frontend/js/arango/templateEngine.js', + 'frontend/js/shell/browser.js', + 'frontend/js/modules/org/arangodb/arango-collection-common.js', + 'frontend/js/modules/org/arangodb/arango-collection.js', + 'frontend/js/modules/org/arangodb/arango-database.js', + 'frontend/js/modules/org/arangodb/arango-query-cursor.js', + 'frontend/js/modules/org/arangodb/arango-statement-common.js', + 'frontend/js/modules/org/arangodb/arango-statement.js', + 'frontend/js/modules/org/arangodb/arangosh.js', + 'frontend/js/modules/org/arangodb/graph-common.js', + 'frontend/js/modules/org/arangodb/graph.js', + 'frontend/js/modules/org/arangodb/mimetypes.js', + 'frontend/js/modules/org/arangodb/simple-query-common.js', + 'frontend/js/modules/org/arangodb/simple-query.js', + 'frontend/js/modules/org/arangodb/aql/functions.js', + 'frontend/js/modules/org/arangodb/graph/traversal.js', + 'frontend/js/modules/org/arangodb-common.js', + 'frontend/js/modules/org/arangodb.js', + 'frontend/js/bootstrap/errors.js', + 'frontend/js/bootstrap/monkeypatches.js', + 'frontend/js/bootstrap/module-internal.js', + 'frontend/js/client/bootstrap/module-internal.js', + 'frontend/js/client/client.js', + + // Mocks + 'test/mocks/disableEJS.js', + + // Models + 'frontend/js/models/arangoCollection.js', + 'frontend/js/models/arangoDatabase.js', + 'frontend/js/models/arangoDocument.js', + 'frontend/js/models/arangoLog.js', + 'frontend/js/models/arangoStatistics.js', + 'frontend/js/models/arangoStatisticsDescription.js', + 'frontend/js/models/foxx.js', + + // Collections + 'frontend/js/collections/arangoCollections.js', + 'frontend/js/collections/arangoDocuments.js', + 'frontend/js/collections/arangoDocument.js', + 'frontend/js/collections/arangoDatabase.js', + 'frontend/js/collections/arangoLogs.js', + 'frontend/js/collections/arangoStatisticsCollection.js', + 'frontend/js/collections/arangoStatisticsDescriptionCollection.js', + 'frontend/js/collections/foxxCollection.js', + + // Views + 'frontend/js/views/navigationView.js', + 'frontend/js/views/footerView.js', + 'frontend/js/views/queryView.js', + 'frontend/js/views/shellView.js', + 'frontend/js/views/aboutView.js', + 'frontend/js/views/dashboardView.js', + 'frontend/js/views/collectionsView.js', + 'frontend/js/views/collectionView.js', + 'frontend/js/views/newCollectionView.js', + 'frontend/js/views/collectionsItemView.js', + 'frontend/js/views/documentsView.js', + 'frontend/js/views/documentView.js', + 'frontend/js/views/documentSourceView.js', + 'frontend/js/views/logsView.js', + 'frontend/js/views/foxxActiveView.js', + 'frontend/js/views/foxxActiveListView.js', + 'frontend/js/views/foxxInstalledView.js', + 'frontend/js/views/foxxInstalledListView.js', + 'frontend/js/views/foxxEditView.js', + 'frontend/js/views/foxxMountView.js', + 'frontend/js/views/appDocumentationView.js', + 'frontend/js/views/graphView.js', + 'frontend/js/views/dbSelectionView.js', + + //Templates + {pattern: 'frontend/js/templates/*.ejs', served:true, included:false, watched: true}, + + // Specs + 'test/specs/arango/arangoSpec.js', + 'test/specs/views/aboutViewSpec.js', + 'test/specs/views/collectionViewSpec.js', + 'test/specs/views/collectionsViewSpec.js', + 'test/specs/views/foxxEditViewSpec.js', + 'test/specs/views/dbSelectionViewSpec.js', + 'test/specs/views/graphViewSpec.js', + 'test/specJSLint/jsLintSpec.js' + ], + + + // list of files to exclude + exclude: [ + + ], + + + // test results reporter to use + // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' + reporters: ['progress'], + + + // web server port + port: 9876, + + + // cli runner port + runnerPort: 9100, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG + logLevel: karma.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers: [], + + + // If browser does not capture in given timeout [ms], kill it + captureTimeout: 60000, + + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false + }); +}; diff --git a/js/apps/system/aardvark/test/specJSLint/jsLintSpec.js b/js/apps/system/aardvark/test/specJSLint/jsLintSpec.js index 6392b4abc3..ab643907fd 100644 --- a/js/apps/system/aardvark/test/specJSLint/jsLintSpec.js +++ b/js/apps/system/aardvark/test/specJSLint/jsLintSpec.js @@ -1,68 +1,78 @@ -describe('JSLint', function () { - var options = {}, - lint = /^\/specJSLint|.jsLintSpec\.js$/; +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global beforeEach, afterEach */ +/*global describe, it, expect, jasmine, spyOn*/ +/*global waitsFor, runs, waits */ +/*global _, JSLINT*/ +/*global document*/ - function get(path) { - path = path + "?" + new Date().getTime(); +(function () { + "use strict"; + describe('JSLint', function () { + var options = {}, + lint = /^\/specJSLint|[\w\W]jsLintSpec\.js$/; - var xhr; - try { - xhr = new jasmine.XmlHttpRequest(); - xhr.open("GET", path, false); - xhr.send(null); - } catch (e) { - throw new Error("couldn't fetch " + path + ": " + e); - } - if (xhr.status < 200 || xhr.status > 299) { - throw new Error("Could not load '" + path + "'."); - } + function get(path) { + path = path + "?" + new Date().getTime(); - return xhr.responseText; - } - - describe('checking codeFiles', function() { - var files = /^(.*lib\/.*)|(.*Spec\.js)$/; - - _.each(document.getElementsByTagName('script'), function (element) { - var script = element.getAttribute('src'); - if (files.test(script)) { - return; + var xhr; + try { + xhr = new jasmine.XmlHttpRequest(); + xhr.open("GET", path, false); + xhr.send(null); + } catch (e) { + throw new Error("couldn't fetch " + path + ": " + e); } - it(script, function () { - var self = this; - var source = get(script); - var result = JSLINT(source, options); - _.each(JSLINT.errors, function (error) { - self.addMatcherResult(new jasmine.ExpectationResult({ - passed: false, - message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence - })); + if (xhr.status < 200 || xhr.status > 299) { + throw new Error("Could not load '" + path + "'."); + } + + return xhr.responseText; + } + + describe('checking codeFiles', function() { + var files = /^([\w\W]*lib\/[\w\W]*)|([\w\W]*Spec\.js)$/; + + _.each(document.getElementsByTagName('script'), function (element) { + var script = element.getAttribute('src'); + if (script === null || files.test(script)) { + return; + } + it(script, function () { + var self = this, + source = get(script), + result = JSLINT(source, options); + _.each(JSLINT.errors, function (error) { + self.addMatcherResult(new jasmine.ExpectationResult({ + passed: false, + message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence + })); + }); + expect(true).toBe(true); // force spec to show up if there are no errors + }); + }); + }); + + describe('checking specFiles', function() { + var files = /^\/spec*|[\w\W]*Spec\.js$/; + + _.each(document.getElementsByTagName('script'), function (element) { + var script = element.getAttribute('src'); + if (!files.test(script) || lint.test(script)) { + return; + } + it(script, function () { + var self = this, + source = get(script), + result = JSLINT(source, options); + _.each(JSLINT.errors, function (error) { + self.addMatcherResult(new jasmine.ExpectationResult({ + passed: false, + message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence + })); + }); + expect(true).toBe(true); // force spec to show up if there are no errors }); - expect(true).toBe(true); // force spec to show up if there are no errors }); }); }); - - describe('checking specFiles', function() { - var files = /^\/spec*|.*Spec\.js$/; - - _.each(document.getElementsByTagName('script'), function (element) { - var script = element.getAttribute('src'); - if (!files.test(script) || lint.test(script)) { - return; - } - it(script, function () { - var self = this; - var source = get(script); - var result = JSLINT(source, options); - _.each(JSLINT.errors, function (error) { - self.addMatcherResult(new jasmine.ExpectationResult({ - passed: false, - message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence - })); - }); - expect(true).toBe(true); // force spec to show up if there are no errors - }); - }); - }); -}); \ No newline at end of file +}()); diff --git a/js/apps/system/aardvark/test/specs/views/.collectionViewSpec.js.swp b/js/apps/system/aardvark/test/specs/views/.collectionViewSpec.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..a3e0ae31adcc8f8adf1718e6ceec7255e3b600eb GIT binary patch literal 12288 zcmeI2ORpO>6vtg8U;*V(gpgQ(8Cqph&CR6k0(9G3slBvPg|3izRDzu|bCURGGBemt z(x`-&)K9=ypqqXPSOQxF3y|2cVo@Phz=pqP^1L@y*F|TfUmTA;_VMp{7E#=3-@I`k z-)LPBxSkW@?wK#&efi!E5e7o^RWi{2{zI+b48n0RwOFheDKq1 zz}OkBdX(EZr7>mkp^a5p+SpF5qhYL+Nyo|zVn^1+wxqdYgfL>2G{@_U;}J`4X^<=zy{dB z|I>ggPl(U3w8!Sl+nJXqj+FB%7i@qHumLu}2G{@_U;}J`4X^<=zy{dBBWOUSLcI8t z5WfTe|Nr9m|J`SW=z+Ju8SoN#5|b0w01lcpUtTSpNZkgFnF^z{md^xDUPp ze6ayGzy{a=8(;%$fDN#LN5#Obc~MB|KLyJAn=hrLTR8RV!qSknlwQjnnP$rsSLuB- zaOP%fo zNr6q6yFezHvUV?6EFidiDMp{mjrpGGP`5DjfCbE_zfzX1T#a>4IYMCTa%c4>S#{jr z?$cW5yh`NOZ1{b9EEQ4)Ba7VPYJ}->Y-Bx)o*h$6ESb8Bq5lKro~vg7 literal 0 HcmV?d00001 diff --git a/js/apps/system/aardvark/test/specs/views/.dbSelectionViewSpec.js.swp b/js/apps/system/aardvark/test/specs/views/.dbSelectionViewSpec.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..c0bf55fc642981780496f8acdf7c28befb2861ca GIT binary patch literal 12288 zcmeI2O>Epm6vw9^pnQ~%_JH7k9&QCr*?KoAQc+M5%|}J0R+U;>kU|vA+OxaUc4GhB*X!4)g>zMR=T!iVqW89yM6|f525(@Buv2Si??D;$3F8=>-{{DaO0mi!EFjxc!z?0w!@Ynr} z{Q-Ui-+?c|XW(P-5x58fZ~#08{@lUXx8N)AA?Smb!E@kg@DyO+`}-LC9DE8s0q=qg z^g#$(;Fo(D`x;yV7eNOc0*`I-4tNW^2~L5B!LN5Sb_Ki-E`vU3g5S5JPw+Fi z0upc>YzJ5GV(bI(3V0Ok1P_5P?quw3&;c&k1%88mKY^>@GI#^L2#$ioAlLVn$SCWi zRp1s;;JiD9pQ&dV(fRzfdM6TRaX?AAd)z<{r#vOjDi?2w?4yOJ;>A}p9=eWGwjEE_bjeS@5?Q1eCO1+I9Tr^1=?cofX@ zFg(mxgyeCtc;p>Qc+`!}U~cJ`RIZcu;w%g( ziWL=7lI)P`2?}MZsK--u8?NcT3G(*guhXCjNAtN>Gby8}PqXQRX9&jg;&se zs52=oO?8fSyGSAjr}CmMVqrpBM9;W_z?IIdx2R7QR@Y3ni0+9zZ8miIe@x~2TufAI zfi8U|PC=P^RD=K_CO?$^>ek|0AI9ql#PHgPm^|D1I;{74oyq6pX!pWQuyYMks;f6^I&} zU=u?kUca;kv7hM*?6u=y4TZHI55>HWckWr?H18;pEONi+Uav?`_Jq^K*hSa(Ll)_;q?)2BHH52f zS>JM_%4o$CT424XY5|L?UEeHPDA$n*b{r#HzNsFhC1<5Lyp4dHZ3w>=w#&x2K9j9% z=WWr66R}C`^Jto$%lVn?uMcGI<<8}+LoXt|KJ*j(1S0hl*%q#|Fh?izyudcULFPJH zDk#N%<7@xdrDJn%H;mgnq?HEkX{`TpwztW~24=hlRsJ<-oaPOZ2tpp@M)?ggZ+#{W zWuyp&9t&ocW*Yd4gS9hDD#=8H`ur?v(=1K5S`8ZYq{5df{e)-`W>}$FYAoAHJW54U Id_>oO1HK2itN;K2 literal 0 HcmV?d00001 diff --git a/js/apps/system/aardvark/test/specs/views/.foxxEditViewSpec.js.swp b/js/apps/system/aardvark/test/specs/views/.foxxEditViewSpec.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..0a3512bcc036db178067d9231b94bd4e83f9ba37 GIT binary patch literal 12288 zcmeI2PmB~r6vhi>K}3*9j4?5$Y}U|=v)#K32|9!r7j^~B!bTP}7=fDUnwi?|?H;>o zW_Ci*gczeSUc8B35D6p(4=P-UCf-Di@nAf8G|_{Jp5#D`epTH)(=)pZ1TX&SPJT1n zUDZ|fzIyLf4OD65(B3J!-PuZTZ6M_I;K^sUpWjPti;x;C&k6nf2G^7**BJNZ@DwYL zhvD4t6C!f_u+0447hf_Bx+)T^$^+?oyvcocR=TWSm#%C}#phkdBCpA!IahJ1Tv_L3 z={5y#Nw*R%EKGPp9m3rKJa=YgZ~OUOu0XE9G72PvTvqO6G4-M@gl%6o3-ET_y0*;s{yCniIY&p#5 zks5MTxQ8|QIOoAG=KI{Ulh-I6w5?4z1rt=cHRP0iQJ!0>YU8ki&*_Nz@4d0{n2*+mvMOi?TCa7sWZoEJ%ji9VV7}!G; zK}~U`MlNGq5UN`=@Fqu$4k!-)RI5Cqj7HoHmx@Ye+_c6d)%8lyn8t#7)^f%etFm@= zEMpO-BHY9MI**+AW+IBhXz>(2D^$&nxSZh&sxt+hcJ#?3rzSi;6?)7ca;~pY)Ci=# zSa*!DKu1SLMl$V3Ts0zCXxwNV2d%Uh>Z`?sl9OSybUT?AuIF)Ce_X=n0^XX^j+kjJ zp2Dnb+VzZzM!3`g^$_E_S{l^ph?A|+^)y|-Yb4zX2WarrR$Z7GgT6gM^k?_N%+$j` zay>mo_>7q+(k<72NySvd6cnkoD-0?KKV=n`tW~7jMjq=eI-aQ*)^*58hihlCGX+UH z=qcCEH1T2sK|IUkya>3%g0?-G#9f?NFg#qbVuM=JS+;=4XMv|P$RwNN-HC2Qet{-E z=%6*P;v=yd;#p?ehNpG@pv;dr^V(Ddv?00G6*Zk+{eqj`bjlYyY1~hLcZ=IgWyA5j z%$&wgGl@xuul5S6Y8;`BxS`rt`T{+UZ4>VmCXh>)jq-SSy)M;zhj7*NRisPKL&q@P zkZRXCykz>|OrL`=*$&D@T4BEAsiA4lz4uh7-ilZ#YU8-?R5_AzGHp8fhe+rq^G=&; zJ>64^vyMG4;@%qS@4#fnB2DM6x7cHf73ot4_V05f(rHi?mA2jW7CmTPWhSCT5u?ppMbtPMx!cpGEsHkCO2prgHZnbet>x7e$af`5MM>-DAUB&)v{#pz_; zVpOKDr(t=6AS`jpNp>MZ{8r0;GMC~F)pWUZQ zC|~EabVQlPjtUP2jQQ^9*w$^?0)#qBdY&5H;hmX@(FS%>ORrmC^qALvw?OIE_81ZGi%ygATgBg1)i4F|2 zH^BtQs+YKJX-lX+Jx&i{E$UxusCF_7t0?vok={J)Abo!AZmIfV2}>Ck@$4>%ZgEMc zOeeuYX9rhEm!oWzbVLR0a8u*ZVj4{aDpVofE)FXsQKSqqpj}@>Hq)$ literal 0 HcmV?d00001 diff --git a/js/apps/system/aardvark/test/specs/views/aboutViewSpec.js b/js/apps/system/aardvark/test/specs/views/aboutViewSpec.js deleted file mode 100644 index 338093184b..0000000000 --- a/js/apps/system/aardvark/test/specs/views/aboutViewSpec.js +++ /dev/null @@ -1,33 +0,0 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global describe, it, expect, jasmine, spyOn*/ -/*global $, d3*/ - - -describe("About View", function() { - "use strict"; - - describe("Checking javascript types", function() { - - it("type null", function() { - var dummy = arangoHelper.RealTypeOf(null); - expect(dummy).toBe('null'); - }); - - it("type array", function() { - var dummy = arangoHelper.RealTypeOf([1,2,3]); - expect(dummy).toBe('array'); - }); - - it("type date", function() { - var dummy = arangoHelper.RealTypeOf(new Date); - expect(dummy).toBe('date'); - }); - - it("type regexp", function() { - var dummy = arangoHelper.RealTypeOf(new RegExp); - expect(dummy).toBe('regex'); - }); - - }); - -}); diff --git a/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js b/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js index 5cff4efa70..7f7fa5e6cb 100644 --- a/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/collectionViewSpec.js @@ -1,43 +1,45 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global describe, it, expect, jasmine, spyOn*/ -/*global $, d3*/ - -describe("Collection View", function() { +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ +/*global describe, beforeEach, afterEach, it, spyOn, expect*/ +/*global runs, waitsFor, jasmine*/ +/*global $, arangoCollection*/ +(function() { "use strict"; - var myView; - window.App = function() {}; - window.App.navigate = function() {}; - beforeEach(function() { - $('body').append('
'); + describe("Collection View", function() { - myView = new window.collectionView({ - model: arangoCollection - }); + var myView; + window.App = function() {}; + window.App.navigate = function() {}; - }); + beforeEach(function() { + $('body').append('
'); - afterEach(function() { - $('.removeMe').remove(); - }); - - - describe("Collection Changes", function() { - it("Check if changes were submitted", function() { - - var pressedEnter = false; - myView.render(); - - spyOn(myView, 'saveModifiedCollection').andCallFake(function(request) { - pressedEnter = true; - console.log("hasdhasd"); + myView = new window.collectionView({ + model: arangoCollection }); - myView.saveModifiedCollection(); - expect(pressedEnter).toBeTruthy(); + }); + + afterEach(function() { + $('.removeMe').remove(); }); - }); -}); + describe("Collection Changes", function() { + it("Check if changes were submitted", function() { + var pressedEnter = false; + myView.render(); + + spyOn(myView, 'saveModifiedCollection').andCallFake(function(request) { + pressedEnter = true; + }); + + myView.saveModifiedCollection(); + expect(pressedEnter).toBeTruthy(); + }); + + + }); + }); +}()); diff --git a/js/apps/system/aardvark/test/specs/views/collectionsViewSpec.js b/js/apps/system/aardvark/test/specs/views/collectionsViewSpec.js index f97a9bfe16..8b6393282d 100644 --- a/js/apps/system/aardvark/test/specs/views/collectionsViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/collectionsViewSpec.js @@ -1,7 +1,7 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global describe, it, expect, jasmine, spyOn*/ -/*global $, d3*/ - +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ +/*global describe, beforeEach, afterEach, it, spyOn, expect*/ +/*global runs, waitsFor, jasmine, waits*/ +/*global $ */ describe("Collections View", function() { "use strict"; @@ -196,9 +196,7 @@ describe("Collections View", function() { check = false; return; } - else { - check = true; - } + check = true; }); expect(check).toBeTruthy(); }); diff --git a/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js b/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js new file mode 100644 index 0000000000..c568adec21 --- /dev/null +++ b/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js @@ -0,0 +1,85 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ +/*global describe, beforeEach, afterEach, it, spyOn, expect*/ +/*global _, $, DBSelectionView*/ + +(function() { + "use strict"; + + describe("DB Selection", function() { + + var view, + list, + dbCollection, + current, + div; + + beforeEach(function() { + dbCollection = new window.ArangoDatabase(); + list = ["_system", "second", "first"]; + current = "first"; + _.each(list, function(n) { + dbCollection.add({name: n}); + }); + spyOn(dbCollection, "fetch"); + spyOn(dbCollection, "getCurrentDatabase").andCallFake( + function() { + return current; + } + ); + div = document.createElement("div"); + div.id = "selectDB"; + document.body.appendChild(div); + }); + + afterEach(function() { + document.body.removeChild(div); + }); + + it("should display all databases ordered", function() { + view = new DBSelectionView({collection: dbCollection}); + view.render($("#selectDB")); + var select = $(div).children()[0], + childs; + expect(div.childElementCount).toEqual(1); + childs = $(select).children(); + expect(childs.length).toEqual(3); + expect(childs[0].id).toEqual(list[0]); + expect(childs[1].id).toEqual(list[2]); + expect(childs[2].id).toEqual(list[1]); + }); + + it("should select the current db", function() { + view = new DBSelectionView({collection: dbCollection}); + view.render($("#selectDB")); + expect($(div).find(":selected").attr("id")).toEqual(current); + }); + + it("should trigger fetch on collection", function() { + view = new DBSelectionView({collection: dbCollection}); + expect(dbCollection.fetch).toHaveBeenCalled(); + }); + + it("should trigger a database switch on click", function() { + view = new DBSelectionView({collection: dbCollection}); + view.render($("#selectDB")); + spyOn(dbCollection, "createDatabaseURL").andReturn("switchURL"); + spyOn(location, "replace"); + $("#dbSelectionList").val("second").trigger("change"); + expect(dbCollection.createDatabaseURL).toHaveBeenCalledWith("second"); + expect(location.replace).toHaveBeenCalledWith("switchURL"); + }); + + it("should not render if the list has only one element", function() { + var oneCollection = new window.ArangoDatabase(); + oneCollection.add({name: current}); + spyOn(oneCollection, "getCurrentDatabase").andCallFake( + function() { + return current; + } + ); + view = new DBSelectionView({collection: oneCollection}); + view.render($("#selectDB")); + expect($(div).text().trim()).toEqual(""); + }); + }); +}()); diff --git a/js/apps/system/aardvark/test/specs/views/foxxEditViewSpec.js b/js/apps/system/aardvark/test/specs/views/foxxEditViewSpec.js new file mode 100644 index 0000000000..4346c31d77 --- /dev/null +++ b/js/apps/system/aardvark/test/specs/views/foxxEditViewSpec.js @@ -0,0 +1,123 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ +/*global describe, beforeEach, afterEach, it, spyOn, expect*/ +/*global runs, waitsFor, jasmine*/ +/*global $, arangoHelper */ + +(function() { + "use strict"; + + describe("Foxx Edit View", function() { + var view, + model, + div; + + beforeEach(function() { + div = document.createElement("div"); + div.id = "modalPlaceholder"; + document.body.appendChild(div); + model = new window.Foxx({ + _key: "1234", + _id: "aal/1234", + title: "TestFoxx", + version: 1.2, + mount: "/testfoxx", + description: "Test application", + git: "gitpath", + app: "app:TestFoxx:1.2", + isSystem: false, + options: { + collectionPrefix: "testfoxx" + }, + development: false + }); + view = new window.foxxEditView({model: model}); + view.render(); + }); + + afterEach(function() { + document.body.removeChild(div); + }); + + it("should be able to switch mount point", function() { + var calledBack, + newMount; + + runs(function() { + newMount = "/newMount"; + spyOn($, "ajax").andCallFake(function(url, options) { + calledBack = true; + }); + $("#change-mount-point").val(newMount); + $("#change").click(); + }); + + waitsFor(function() { + return calledBack; + }, 1000); + + runs(function() { + expect($.ajax).toHaveBeenCalledWith( + "foxx/move/" + model.get("_key"),{ + dataType: "json", + data: JSON.stringify({ + mount: newMount, + app: model.get("app"), + prefix: model.get("options").collectionPrefix + }), + async: false, + type: "PUT", + error: jasmine.any(Function) + }); + }); + }); + + it("should not hide the modal view if mountpoint change has failed", function() { + var calledBack, + newMount, + resText; + + runs(function() { + newMount = "/newMount"; + resText = "Mount-Point already in use"; + spyOn($, "ajax").andCallFake(function(url, options) { + expect(options.error).toEqual(jasmine.any(Function)); + options.error( + { + status: 409, + statusText: "Conflict", + responseText: resText + } + ); + calledBack = true; + }); + spyOn(view, "hideModal"); + spyOn(arangoHelper, "arangoError"); + $("#change-mount-point").val(newMount); + $("#change").click(); + }); + + waitsFor(function() { + return calledBack; + }, 1000); + + runs(function() { + expect(view.hideModal).not.toHaveBeenCalled(); + expect(arangoHelper.arangoError).toHaveBeenCalledWith(resText); + }); + + }); + + it("should not trigger a remount if mountpoint has not been changed", function() { + spyOn(window, "alert"); + $("#change").click(); + expect(window.alert).not.toHaveBeenCalled(); + }); + + it("should prevent an illegal mountpoint", function() { + spyOn(window, "alert"); + $("#change-mount-point").val("illegal"); + $("#change").click(); + expect(window.alert).toHaveBeenCalled(); + }); + }); +}()); diff --git a/js/apps/system/aardvark/test/specs/views/graphViewSpec.js b/js/apps/system/aardvark/test/specs/views/graphViewSpec.js new file mode 100644 index 0000000000..825f5365fa --- /dev/null +++ b/js/apps/system/aardvark/test/specs/views/graphViewSpec.js @@ -0,0 +1,20 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/ +/*global describe, beforeEach*/ +(function() { + "use strict"; + + describe("Graph View", function() { + + var view, + div; + + beforeEach(function() { + div = document.createElement("div"); + div.id = "content"; + + }); + + + }); + +}());