Fix test for new module route
The js base route is now js/modules/%modulename%/%file%. This commit reflects these changes in the testcases refs #4092 refs #3735
This commit is contained in:
parent
fc83dfb4ef
commit
33b4a2ced0
|
@ -9,12 +9,12 @@
|
|||
// {{LICENSE_HEADER}}
|
||||
var should = require("should");
|
||||
var rjsmock = require("requiremock.js");
|
||||
var asyncMock = require("asyncmock.js");
|
||||
|
||||
requireNew("icinga/module.js");
|
||||
var BASE = "../../../../public/js/";
|
||||
require(BASE+"icinga/module.js");
|
||||
|
||||
var module = rjsmock.getDefine();
|
||||
GLOBAL.document = $('body');
|
||||
|
||||
/**
|
||||
* Test module that only uses eventhandlers and
|
||||
* no custom logic
|
||||
|
@ -195,9 +195,6 @@ describe('The icinga module bootstrap', function() {
|
|||
var testClick = false;
|
||||
rjsmock.registerDependencies({
|
||||
"icinga/module": module,
|
||||
"icinga/util/async" : {
|
||||
registerHeaderListener: function() {}
|
||||
},
|
||||
"modules/test/test" : {
|
||||
eventHandler: {
|
||||
"a.test" : {
|
||||
|
@ -217,7 +214,7 @@ describe('The icinga module bootstrap', function() {
|
|||
]
|
||||
});
|
||||
tearDownTestDOM();
|
||||
requireNew("icinga/icinga.js");
|
||||
require(BASE+"icinga/icinga.js");
|
||||
var icinga = rjsmock.getDefine();
|
||||
$('body').append($("<a class='test'></a>"));
|
||||
$('a.test').click();
|
||||
|
@ -226,55 +223,4 @@ describe('The icinga module bootstrap', function() {
|
|||
should.equal(icinga.getFailedModules()[0].name, "test2");
|
||||
tearDownTestDOM();
|
||||
});
|
||||
|
||||
it("Should load modules lazily when discovering a X-Icinga-Enable-Module header", function() {
|
||||
rjsmock.purgeDependencies();
|
||||
|
||||
requireNew("icinga/util/async.js");
|
||||
var async = rjsmock.getDefine();
|
||||
|
||||
rjsmock.registerDependencies({
|
||||
"icinga/module": module,
|
||||
"icinga/util/async": async,
|
||||
"modules/test/test" : {
|
||||
eventHandler: {
|
||||
"a.test" : {
|
||||
click : function() {
|
||||
testClick = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"icinga/container" : {
|
||||
registerAsyncMgr: function() {},
|
||||
initializeContainers: function() {}
|
||||
},
|
||||
"modules/list" : [
|
||||
]
|
||||
});
|
||||
|
||||
tearDownTestDOM();
|
||||
|
||||
requireNew("icinga/icinga.js");
|
||||
var icinga = rjsmock.getDefine();
|
||||
|
||||
var testClick = false;
|
||||
// The module shouldn't be loaded
|
||||
$('body').append($("<a class='test'></a>"));
|
||||
$('a.test').click();
|
||||
should.equal(testClick, false, "Unregistered module was loaded");
|
||||
|
||||
asyncMock.setNextAsyncResult(async,"result", false, {
|
||||
"X-Icinga-Enable-Module" : "test"
|
||||
});
|
||||
async.createRequest();
|
||||
// The module shouldn't be loaded
|
||||
$('body').append($("<a class='test'></a>"));
|
||||
$('a.test').click();
|
||||
should.equal(testClick, true, "Module wasn't automatically loaded on header!");
|
||||
|
||||
|
||||
tearDownTestDOM();
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue