mirror of https://gitee.com/bigwinds/arangodb
Added tests for cluster views, of necessary information is passed through each view
This commit is contained in:
parent
8d48855875
commit
d78e3ed92b
|
@ -1,5 +1,5 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */
|
||||
/*global window, Backbone */
|
||||
/*global window, Backbone, console */
|
||||
(function() {
|
||||
"use strict";
|
||||
window.ClusterCoordinators = Backbone.Collection.extend({
|
||||
|
|
|
@ -223,12 +223,21 @@ module.exports = function(karma) {
|
|||
// 'test/specs/graphViewer/specNodeReducer/modularityJoinerSpec.js',
|
||||
// 'test/specs/graphViewer/specWindowObjects/workerWrapperSpec.js',
|
||||
'test/specs/graphViewer/specContextMenu/contextMenuSpec.js',
|
||||
|
||||
// Arango
|
||||
'test/specs/arango/arangoSpec.js',
|
||||
|
||||
// Models
|
||||
'test/specs/models/currentDatabaseSpec.js',
|
||||
'test/specs/models/graphSpec.js',
|
||||
|
||||
// Collections
|
||||
'test/specs/collections/clusterServersSpec.js',
|
||||
'test/specs/collections/clusterDatabasesSpec.js',
|
||||
'test/specs/collections/clusterCollectionsSpec.js',
|
||||
'test/specs/collections/clusterShardsSpec.js',
|
||||
|
||||
|
||||
// Views
|
||||
'test/specs/views/editListEntryViewSpec.js',
|
||||
'test/specs/views/collectionViewSpec.js',
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
"use strict";
|
||||
|
||||
describe("Cluster Collection View", function() {
|
||||
var view, div, shardsView, shardCol;
|
||||
var view, div, shardsView, shardCol, server, db;
|
||||
|
||||
beforeEach(function() {
|
||||
server = "pavel";
|
||||
db = "_system";
|
||||
div = document.createElement("div");
|
||||
div.id = "clusterCollections";
|
||||
document.body.appendChild(div);
|
||||
|
@ -81,7 +83,7 @@
|
|||
view = new window.ClusterCollectionView({
|
||||
collection: collCol
|
||||
});
|
||||
view.render();
|
||||
view.render(db, server);
|
||||
});
|
||||
|
||||
it("should not unrender the server view", function() {
|
||||
|
@ -117,27 +119,18 @@
|
|||
});
|
||||
|
||||
it("should be able to navigate to Documents", function() {
|
||||
info = {
|
||||
name: "Documents"
|
||||
};
|
||||
$("#Documents").click();
|
||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
||||
expect(shardsView.render).toHaveBeenCalledWith(db, "Documents", server);
|
||||
});
|
||||
|
||||
it("should be able to navigate to Edges", function() {
|
||||
info = {
|
||||
name: "Edges"
|
||||
};
|
||||
$("#Edges").click();
|
||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
||||
expect(shardsView.render).toHaveBeenCalledWith(db, "Edges", server);
|
||||
});
|
||||
|
||||
it("should be able to navigate to People", function() {
|
||||
info = {
|
||||
name: "People"
|
||||
};
|
||||
$("#People").click();
|
||||
expect(shardsView.render).toHaveBeenCalledWith(info);
|
||||
expect(shardsView.render).toHaveBeenCalledWith(db, "People", server);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"use strict";
|
||||
|
||||
describe("Cluster Database View", function() {
|
||||
var view, div, colView, colCol;
|
||||
var view, div, colView, colCol, server;
|
||||
|
||||
beforeEach(function() {
|
||||
server = "pavel";
|
||||
div = document.createElement("div");
|
||||
div.id = "clusterDatabases";
|
||||
document.body.appendChild(div);
|
||||
|
@ -83,7 +84,7 @@
|
|||
view = new window.ClusterDatabaseView({
|
||||
collection: dbCol
|
||||
});
|
||||
view.render();
|
||||
view.render(server);
|
||||
});
|
||||
|
||||
it("should not render the Server view", function() {
|
||||
|
@ -116,19 +117,19 @@
|
|||
it("should be able to navigate to _system", function() {
|
||||
db = "_system";
|
||||
$("#" + db).click();
|
||||
expect(colView.render).toHaveBeenCalledWith(db);
|
||||
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||
});
|
||||
|
||||
it("should be able to navigate to myDatabase", function() {
|
||||
db = "myDatabase";
|
||||
$("#" + db).click();
|
||||
expect(colView.render).toHaveBeenCalledWith(db);
|
||||
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||
});
|
||||
|
||||
it("should be able to navigate to otherDatabase", function() {
|
||||
db = "otherDatabase";
|
||||
$("#" + db).click();
|
||||
expect(colView.render).toHaveBeenCalledWith(db);
|
||||
expect(colView.render).toHaveBeenCalledWith(db, server);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -57,11 +57,8 @@
|
|||
dbView.render.reset();
|
||||
view.render.reset();
|
||||
var name = o.primary.name;
|
||||
info = {
|
||||
name: name
|
||||
};
|
||||
$(getTile(name)).click();
|
||||
expect(dbView.render).toHaveBeenCalledWith(info);
|
||||
expect(dbView.render).toHaveBeenCalledWith(name);
|
||||
expect(view.render).toHaveBeenCalledWith(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,27 +22,27 @@
|
|||
describe("rendering", function() {
|
||||
|
||||
var s1, s2, s3, shards, shardCol,
|
||||
checkButtonContent = function(col, cls) {
|
||||
var btn = document.getElementById(col.name);
|
||||
checkButtonContent = function(sh, cls) {
|
||||
var btn = document.getElementById(sh.id);
|
||||
expect(btn).toBeOfClass("btn");
|
||||
expect(btn).toBeOfClass("btn-server");
|
||||
expect(btn).toBeOfClass("shard");
|
||||
expect(btn).toBeOfClass("btn-" + cls);
|
||||
expect($(btn).text()).toEqual(col.name);
|
||||
expect($(btn).text()).toEqual(sh.id);
|
||||
};
|
||||
|
||||
|
||||
beforeEach(function() {
|
||||
s1 = {
|
||||
name: "Shard 1",
|
||||
id: "Shard 1",
|
||||
status: "ok"
|
||||
};
|
||||
s2 = {
|
||||
name: "Shard 2",
|
||||
id: "Shard 2",
|
||||
status: "warning"
|
||||
};
|
||||
s3 = {
|
||||
name: "Shard 3",
|
||||
id: "Shard 3",
|
||||
status: "critical"
|
||||
};
|
||||
shards = [
|
||||
|
|
Loading…
Reference in New Issue