mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Wrote spec for UI of GraphViewer
This commit is contained in:
parent
640b04b4c2
commit
799def1033
|
@ -31,11 +31,14 @@
|
|||
<script type="text/javascript" src="../ui/nodeShaperControls.js"></script>
|
||||
<script type="text/javascript" src="../ui/edgeShaperControls.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../ui/graphViewerUI.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../graphViewer.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script type="text/javascript" src="specGraphViewer/graphViewerSpec.js"></script>
|
||||
<script type="text/javascript" src="specGraphViewer/graphViewerUISpec.js"></script>
|
||||
|
||||
<!-- run JSLINT -->
|
||||
<script type="text/javascript" src="specJSLint/jsLintSpec.js"></script>
|
||||
|
|
|
@ -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() {
|
||||
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}());
|
|
@ -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";
|
||||
|
||||
|
||||
}
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue