From 25878be3d48514d2e1c42ad31745cb4a31f73aba Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 12 Feb 2014 13:54:32 +0100 Subject: [PATCH 1/8] added fix for absolute path --- js/common/bootstrap/modules.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js index 20e45f2912..994b3ee2ce 100644 --- a/js/common/bootstrap/modules.js +++ b/js/common/bootstrap/modules.js @@ -256,7 +256,13 @@ function require (path) { return null; } - return uri.substr(8); + var filename = uri.substr(8); + + if (filename[0] === ".") { + return filename; + } + + return "/" + filename; } //////////////////////////////////////////////////////////////////////////////// From 6d55f35058be84ab881962159a3af4ff8f37e8c0 Mon Sep 17 00:00:00 2001 From: gschwab Date: Wed, 12 Feb 2014 14:12:18 +0100 Subject: [PATCH 2/8] fixed test --- .../test/specs/views/dbSelectionViewSpec.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js b/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js index f76c7a676d..1e44b3d5a9 100644 --- a/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/dbSelectionViewSpec.js @@ -26,7 +26,7 @@ }); fetched = false; spyOn(dbCollection, "fetch"); - div = document.createElement("div"); + div = document.createElement("li"); div.id = "dbSelect"; document.body.appendChild(div); view = new DBSelectionView( @@ -43,19 +43,21 @@ it("should display all databases ordered", function() { view.render($(div)); - var select = $(div).children()[0], + var dbList = $("#dbs_dropdown", $(div)), childs; - expect(div.childElementCount).toEqual(1); - childs = $(select).children(); + + expect(div.childElementCount).toEqual(2); + childs = $(dbList).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]); + + + expect($("a", $(childs[1])).attr("id")).toEqual(list[0]); + expect($("a", $(childs[2])).attr("id")).toEqual(list[1]); }); it("should select the current db", function() { view.render($(div)); - expect($(div).find(":selected").attr("id")).toEqual(current.get("name")); + expect($($(div).children()[0]).text()).toEqual("DB: " + current.get("name") + " "); }); it("should trigger fetch on collection", function() { @@ -84,7 +86,7 @@ } ); view.render($(div)); - expect($(div).text().trim()).toEqual("first"); + expect($(div).text().trim()).toEqual("DB: first"); }); }); }()); From ae3fa2ec776cbba99d410a9c524c423d4198d962 Mon Sep 17 00:00:00 2001 From: gschwab Date: Wed, 12 Feb 2014 14:36:27 +0100 Subject: [PATCH 3/8] more tests fixed --- .../aardvark/test/specs/router/routerSpec.js | 14 ++++++++- .../test/specs/views/navigationViewSpec.js | 30 +++++-------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/js/apps/system/aardvark/test/specs/router/routerSpec.js b/js/apps/system/aardvark/test/specs/router/routerSpec.js index 91a2f5a865..aa4db734e6 100644 --- a/js/apps/system/aardvark/test/specs/router/routerSpec.js +++ b/js/apps/system/aardvark/test/specs/router/routerSpec.js @@ -19,7 +19,9 @@ sessionDummy, graphsDummy, foxxDummy, - logsDummy; + logsDummy, + statisticBarDummy, + userBarDummy; // Spy on all views that are initialized by startup beforeEach(function() { @@ -66,6 +68,14 @@ foxxDummy = { id: "foxxDummy" }; + statisticBarDummy = { + id: "statisticBarDummy", + render : function(){} + }; + userBarDummy = { + id: "userBarDummy", + render : function(){} + }; spyOn(storeDummy, "fetch"); spyOn(window, "arangoCollections").andReturn(storeDummy); spyOn(window, "ArangoUsers").andReturn(sessionDummy); @@ -103,6 +113,8 @@ expect(options.async).toBeFalsy(); }); spyOn(window, "DBSelectionView"); + spyOn(window, "StatisticBarView").andReturn(statisticBarDummy); + spyOn(window, "UserBarView").andReturn(userBarDummy); }); describe("initialisation", function() { diff --git a/js/apps/system/aardvark/test/specs/views/navigationViewSpec.js b/js/apps/system/aardvark/test/specs/views/navigationViewSpec.js index 53333ea643..61cb197a65 100644 --- a/js/apps/system/aardvark/test/specs/views/navigationViewSpec.js +++ b/js/apps/system/aardvark/test/specs/views/navigationViewSpec.js @@ -7,7 +7,7 @@ describe("The navigation bar", function() { - var div, view, currentDBFake, curName, isSystem; + var div, view, currentDBFake, curName, isSystem, DBSelectionViewDummy; beforeEach(function() { curName = "_system"; @@ -15,6 +15,13 @@ window.currentDB = window.currentDB || { get: function() {} }; + + DBSelectionViewDummy = { + id : "DBSelectionViewDummy", + render : function(){} + }; + + spyOn(window, "DBSelectionView").andReturn(DBSelectionViewDummy); spyOn(window.currentDB, "get").andCallFake(function(key) { if (key === "name") { return curName; @@ -40,14 +47,6 @@ view.render(); }); - it("should offer a dashboard tab", function() { - var tab = $("#dashboard", $(div)); - expect(tab.length).toEqual(1); - spyOn(window.App, "navigate"); - tab.click(); - expect(window.App.navigate).toHaveBeenCalledWith("dashboard", {trigger: true}); - }); - it("should offer a collections tab", function() { var tab = $("#collections", $(div)); expect(tab.length).toEqual(1); @@ -106,14 +105,6 @@ view.render(); }); - it("should offer a databases tab", function() { - var tab = $("#databases", $(div)); - expect(tab.length).toEqual(1); - spyOn(window.App, "navigate"); - tab.click(); - expect(window.App.navigate).toHaveBeenCalledWith("databases", {trigger: true}); - }); - it("should offer a logs tab", function() { var tab = $("#logs", $(div)); expect(tab.length).toEqual(1); @@ -132,11 +123,6 @@ view.render(); }); - it("should not offer a databases tab", function() { - var tab = $("#databases", $(div)); - expect(tab.length).toEqual(0); - }); - it("should not offer a logs tab", function() { var tab = $("#logs", $(div)); expect(tab.length).toEqual(0); From 0d2f3b945fd169b556270cea2b6c00aa39fe78c9 Mon Sep 17 00:00:00 2001 From: gschwab Date: Wed, 12 Feb 2014 14:44:53 +0100 Subject: [PATCH 4/8] karma configuration fixed --- js/apps/system/aardvark/test/karma/karma.conf.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/apps/system/aardvark/test/karma/karma.conf.js b/js/apps/system/aardvark/test/karma/karma.conf.js index d95821959c..2d878ec19a 100644 --- a/js/apps/system/aardvark/test/karma/karma.conf.js +++ b/js/apps/system/aardvark/test/karma/karma.conf.js @@ -171,6 +171,8 @@ module.exports = function(karma) { 'frontend/js/views/dbSelectionView.js', 'frontend/js/views/editListEntryView.js', 'frontend/js/views/loginView.js', + 'frontend/js/views/statisticBarView.js', + 'frontend/js/views/userBarView.js', // Router 'frontend/js/routers/router.js', From 89b6ca0ba3b048e0cb947ad2ffac5578c140c9ad Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 12 Feb 2014 22:04:19 +0100 Subject: [PATCH 5/8] fixed test setup --- js/common/tests/shell-require.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/common/tests/shell-require.js b/js/common/tests/shell-require.js index c8f625bcb4..14171771af 100644 --- a/js/common/tests/shell-require.js +++ b/js/common/tests/shell-require.js @@ -102,10 +102,12 @@ function CommonJSTestSuite () { var console = require("console"); function createTestPackage (testPath) { - var lib = fs.join( + var lib = "./" + fs.join( "./js/common/test-data/modules/commonjs/tests/modules/1.0/", testPath); + console.log(lib); + var test = module.createTestEnvironment(lib); test.exports.print = require("internal").print; From c58342f08a1636ff63c120f2d4d42343ca49f203 Mon Sep 17 00:00:00 2001 From: gschwab Date: Thu, 13 Feb 2014 08:43:19 +0100 Subject: [PATCH 6/8] changed 'blubber' to 'Tools' --- .../system/aardvark/frontend/js/templates/navigationView.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs b/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs index e2800989bd..a539ac222e 100644 --- a/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs +++ b/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs @@ -10,7 +10,7 @@