mirror of https://gitee.com/bigwinds/arangodb
fixed navigationViewSpec.js tests
This commit is contained in:
parent
e881504e40
commit
0f7777c3bf
|
@ -8,11 +8,14 @@
|
||||||
describe("The navigation bar", function() {
|
describe("The navigation bar", function() {
|
||||||
|
|
||||||
var div, view, currentDBFake, curName, isSystem,
|
var div, view, currentDBFake, curName, isSystem,
|
||||||
DBSelectionViewDummy, StatisticBarViewDummy, UserBarViewDummy;
|
DBSelectionViewDummy, StatisticBarViewDummy, UserBarViewDummy,
|
||||||
|
NotificationViewDummy, UserCollectionDummy, oldRouter;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
curName = "_system";
|
curName = "_system";
|
||||||
isSystem = true;
|
isSystem = true;
|
||||||
|
oldRouter = window.App;
|
||||||
|
window.App = {navigate : function(){}};
|
||||||
|
|
||||||
window.currentDB = window.currentDB || {
|
window.currentDB = window.currentDB || {
|
||||||
get: function() {}
|
get: function() {}
|
||||||
|
@ -33,9 +36,22 @@
|
||||||
render : function(){}
|
render : function(){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NotificationViewDummy = {
|
||||||
|
id : "NotificationViewDummy",
|
||||||
|
render : function(){}
|
||||||
|
};
|
||||||
|
|
||||||
|
UserCollectionDummy = {
|
||||||
|
id : "UserCollectionDummy",
|
||||||
|
whoAmI : function () {return "root";}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
spyOn(window, "UserBarView").andReturn(UserBarViewDummy);
|
spyOn(window, "UserBarView").andReturn(UserBarViewDummy);
|
||||||
spyOn(window, "StatisticBarView").andReturn(StatisticBarViewDummy);
|
spyOn(window, "StatisticBarView").andReturn(StatisticBarViewDummy);
|
||||||
spyOn(window, "DBSelectionView").andReturn(DBSelectionViewDummy);
|
spyOn(window, "DBSelectionView").andReturn(DBSelectionViewDummy);
|
||||||
|
spyOn(window, "NotificationView").andReturn(NotificationViewDummy);
|
||||||
spyOn(window.currentDB, "get").andCallFake(function(key) {
|
spyOn(window.currentDB, "get").andCallFake(function(key) {
|
||||||
if (key === "name") {
|
if (key === "name") {
|
||||||
return curName;
|
return curName;
|
||||||
|
@ -52,12 +68,13 @@
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
document.body.removeChild(div);
|
document.body.removeChild(div);
|
||||||
|
window.App = oldRouter;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("in any database", function() {
|
describe("in any database", function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
view = new window.NavigationView();
|
view = new window.NavigationView({userCollection : UserCollectionDummy});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,7 +132,7 @@
|
||||||
describe("in _system database", function() {
|
describe("in _system database", function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
view = new window.NavigationView();
|
view = new window.NavigationView({userCollection : UserCollectionDummy});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -133,7 +150,7 @@
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
curName = "firstDB";
|
curName = "firstDB";
|
||||||
isSystem = false;
|
isSystem = false;
|
||||||
view = new window.NavigationView();
|
view = new window.NavigationView({userCollection : UserCollectionDummy});
|
||||||
view.render();
|
view.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue