diff --git a/html/admin/js/graphViewer/jasmine_test/runnerGraphViewer.html b/html/admin/js/graphViewer/jasmine_test/runnerGraphViewer.html index ea318db7f6..85b86d5602 100644 --- a/html/admin/js/graphViewer/jasmine_test/runnerGraphViewer.html +++ b/html/admin/js/graphViewer/jasmine_test/runnerGraphViewer.html @@ -31,11 +31,14 @@ + + + diff --git a/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerSpec.js b/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerSpec.js index 36f2d52f42..518801839d 100644 --- a/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerSpec.js @@ -38,6 +38,7 @@ describe("Graph Viewer", function() { "use strict"; var viewer, + waittime = 100, svg, docSVG, @@ -243,7 +244,7 @@ describe("Graph Viewer", function() { // Give it a second to load // Unfortunately there is no handle to check for changes - waits(1000); + waits(waittime); runs (function() { expect([0, 1, 2, 3, 4]).toBeDisplayed(); @@ -257,7 +258,7 @@ describe("Graph Viewer", function() { viewer.loadGraph(0); }); - waits(1000); + waits(waittime); }); @@ -294,7 +295,7 @@ describe("Graph Viewer", function() { clickOnNode(1); }); - waits(1000); + waits(waittime); runs (function() { expect([0, 1, 2, 3, 4, 5, 6, 7]).toBeDisplayed(); @@ -308,7 +309,7 @@ describe("Graph Viewer", function() { clickOnNode(0); }); - waits(1000); + waits(waittime); runs (function() { // Load 1 Nodes: Root @@ -323,7 +324,7 @@ describe("Graph Viewer", function() { viewer.loadGraph(42); }); - waits(1000); + waits(waittime); runs (function() { expect([42, 43, 44, 45]).toBeDisplayed(); @@ -342,7 +343,7 @@ describe("Graph Viewer", function() { clickOnNode(4); }); - waits(1000); + waits(waittime); it("the graph should still be correct", function() { expect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12]).toBeDisplayed(); @@ -361,14 +362,14 @@ describe("Graph Viewer", function() { }); // Wait a gentle second for all nodes to expand properly - waits(1000); + waits(waittime); runs(function() { clickOnNode(1); clickOnNode(4); }); - waits(1000); + waits(waittime); }); it("the graph should still be correct", function() { @@ -386,7 +387,7 @@ describe("Graph Viewer", function() { clickOnNode(3); }); - waits(1000); + waits(waittime); }); @@ -401,7 +402,7 @@ describe("Graph Viewer", function() { clickOnNode(2); }); - waits(1000); + waits(waittime); runs (function() { expect([2, 3, 8]).toBeDisplayed(); @@ -418,7 +419,7 @@ describe("Graph Viewer", function() { clickOnNode(3); }); - waits(1000); + waits(waittime); runs (function() { expect([2, 3, 8]).toBeDisplayed(); @@ -435,7 +436,7 @@ describe("Graph Viewer", function() { clickOnNode(2); }); - waits(1000); + waits(waittime); runs (function() { expect([2, 3]).toBeDisplayed(); @@ -456,7 +457,7 @@ describe("Graph Viewer", function() { clickOnNode(2); clickOnNode(3); }); - waits(1000); + waits(waittime); }); it("should be able to collapse a node " @@ -466,7 +467,7 @@ describe("Graph Viewer", function() { clickOnNode(1); }); - waits(1000); + waits(waittime); runs(function() { diff --git a/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerUISpec.js b/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerUISpec.js new file mode 100644 index 0000000000..13ce1c1c09 --- /dev/null +++ b/html/admin/js/graphViewer/jasmine_test/specGraphViewer/graphViewerUISpec.js @@ -0,0 +1,118 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global beforeEach, afterEach */ +/*global describe, it, expect, jasmine*/ +/*global runs, waitsFor, spyOn */ +/*global window, eb, loadFixtures, document */ +/*global $, _, d3*/ +/*global helper, mocks*/ +/*global GraphViewerUI*/ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + + +(function () { + "use strict"; + + describe('Graph Viewer UI', function () { + + var div, + ui; + + beforeEach(function() { + div = document.createElement("div"); + div.id = "contentDiv"; + document.body.appendChild(div); + ui = new GraphViewerUI(div); + }); + + afterEach(function() { + document.removeChild(div); + }); + + it('should append a svg to the given parent', function() { + expect($("#contentDiv svg").length).toEqual(1); + }); + + describe('checking the toolbox', function() { + var toolboxSelector = "#contentDiv #toolbox"; + + it('should append the toolbox', function() { + expect($(toolboxSelector).length).toEqual(1); + }); + + it('should contain the objects from eventDispatcher', function() { + + expect($(toolboxSelector + " #control_drag").length).toEqual(1); + expect($(toolboxSelector + " #control_edit").length).toEqual(1); + expect($(toolboxSelector + " #control_expand").length).toEqual(1); + expect($(toolboxSelector + " #control_delete").length).toEqual(1); + expect($(toolboxSelector + " #control_connect").length).toEqual(1); + }); + }); + + describe('checking the menubar', function() { + + it('should append the menubar', function() { + expect($("#contentDiv #menubar").length).toEqual(1); + }); + + it('should contain a menu for the node shapes', function() { + var menuSelector = "#contentDiv #menubar #nodeshapermenu"; + expect($(menuSelector).length).toEqual(1); + expect($(menuSelector + " #control_none").length).toEqual(1); + expect($(menuSelector + " #control_circle").length).toEqual(1); + expect($(menuSelector + " #control_rect").length).toEqual(1); + expect($(menuSelector + " #control_label").length).toEqual(1); + expect($(menuSelector + " #control_singlecolour").length).toEqual(1); + expect($(menuSelector + " #control_attributecolour").length).toEqual(1); + expect($(menuSelector + " #control_expandcolour").length).toEqual(1); + }); + + it('should contain a menu for the edge shapes', function() { + var menuSelector = "#contentDiv #menubar #edgeshapermenu"; + expect($(menuSelector).length).toEqual(1); + expect($(menuSelector + " #control_none").length).toEqual(1); + expect($(menuSelector + " #control_arrow").length).toEqual(1); + expect($(menuSelector + " #control_label").length).toEqual(1); + expect($(menuSelector + " #control_singlecolour").length).toEqual(1); + expect($(menuSelector + " #control_attributecolour").length).toEqual(1); + expect($(menuSelector + " #control_gradientcolour").length).toEqual(1); + }); + + it('should contain a menu for the adapter', function() { + var menuSelector = "#contentDiv #menubar #adaptermenu"; + expect($(menuSelector).length).toEqual(1); + + expect(false).toBeTruthy(); + }); + + }); + + }); + +}()); \ No newline at end of file diff --git a/html/admin/js/graphViewer/ui/graphViewerUI.js b/html/admin/js/graphViewer/ui/graphViewerUI.js new file mode 100644 index 0000000000..4dc6be9731 --- /dev/null +++ b/html/admin/js/graphViewer/ui/graphViewerUI.js @@ -0,0 +1,34 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global document, $, _ */ +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + +function GraphViewerUI(list, shaper) { + "use strict"; + + +} \ No newline at end of file diff --git a/html/admin/js/graphViewer/ui/modalDialogHelper.js b/html/admin/js/graphViewer/ui/modalDialogHelper.js index 30225a4f02..909698ed91 100644 --- a/html/admin/js/graphViewer/ui/modalDialogHelper.js +++ b/html/admin/js/graphViewer/ui/modalDialogHelper.js @@ -1,5 +1,33 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ /*global document, $, _ */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + var modalDialogHelper = modalDialogHelper || {}; (function dialogHelper() { diff --git a/html/admin/js/graphViewer/ui/uiComponentsHelper.js b/html/admin/js/graphViewer/ui/uiComponentsHelper.js index 6795cf3003..8d918dab61 100644 --- a/html/admin/js/graphViewer/ui/uiComponentsHelper.js +++ b/html/admin/js/graphViewer/ui/uiComponentsHelper.js @@ -1,5 +1,33 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ /*global document, $, _ */ + +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @file +/// +/// DISCLAIMER +/// +/// Copyright 2010-2012 triagens GmbH, Cologne, Germany +/// +/// Licensed under the Apache License, Version 2.0 (the "License"); +/// you may not use this file except in compliance with the License. +/// You may obtain a copy of the License at +/// +/// http://www.apache.org/licenses/LICENSE-2.0 +/// +/// Unless required by applicable law or agreed to in writing, software +/// distributed under the License is distributed on an "AS IS" BASIS, +/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +/// See the License for the specific language governing permissions and +/// limitations under the License. +/// +/// Copyright holder is triAGENS GmbH, Cologne, Germany +/// +/// @author Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// + var uiComponentsHelper = uiComponentsHelper || {}; (function componentsHelper() {