fix frontend tests, error on loader loader second time

This commit is contained in:
Yuri Kuznetsov
2023-06-14 12:05:13 +03:00
parent 431f7e6fd5
commit ecb6ec3adf
5 changed files with 92 additions and 76 deletions
@@ -46,10 +46,6 @@
"exportsAs": "Flotr",
"sourceMap": true
},
"Base64": {
"exportsTo": "window",
"exportsAs": "Base64"
},
"espo-funnel-chart": {
"path": "client/lib/espo-funnel-chart.js",
"exportsTo": "window",
+4
View File
@@ -34,6 +34,10 @@
root.Espo = {};
}
if (root.Espo.loader) {
throw new Error("Loader was already loaded.");
}
/**
* A callback with resolved dependencies passed as parameters.
* Should return a value to define a module.
+86
View File
@@ -0,0 +1,86 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
let scriptEl = document.createElement('script');
scriptEl.setAttribute('type', 'application/json');
scriptEl.setAttribute('data-name', 'loader-params');
scriptEl.textContent = JSON.stringify({
basePath: '../../',
libsConfig: {
"espo": {
"exportsTo": "window",
"exportsAs": "Espo"
},
"jquery": {
"expose": true,
"exposeAs": "$",
"amdId": "jquery"
},
"backbone": {
"exportsTo": "window",
"exportsAs": "Backbone"
},
"bullbone": {
"expose": true,
"exposeAs": "Bull",
"amdId": "bullbone"
},
"handlebars": {
"expose": true,
"exposeAs": "Handlebars"
},
"underscore": {
"expose": true,
"exposeAs": "_",
"amdId": "underscore"
},
"marked": {},
"dompurify": {
"expose": true,
"exposeAs": "DOMPurify"
},
"base64": {
"exportsTo": "window",
"exportsAs": "Base64"
},
"moment": {
"exportsTo": "window",
"exportsAs": "moment"
}
},
aliasMap: {
"jquery": "lib!jquery",
"bullbone": "lib!bullbone",
"underscore": "lib!underscore",
"cronstrue": "lib!cronstrue",
"exif-js": "lib!exif"
}
});
document.head.appendChild(scriptEl);
+2 -3
View File
@@ -1,9 +1,8 @@
{
"srcDir": ".",
"srcFiles": [
"client/lib/espo-libs.min.js",
"client/lib/transpiled/src/loader.js",
"frontend/test/loader-init-libs.js",
"frontend/test/init.js",
"client/lib/espo.min.js",
"client/lib/transpiled/src/exceptions.js",
"client/lib/transpiled/src/utils.js",
"client/lib/transpiled/src/ajax.js",
-69
View File
@@ -1,69 +0,0 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2023 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.loader.addLibsConfig({
"espo": {
"exportsTo": "window",
"exportsAs": "Espo"
},
"jquery": {
"expose": true,
"exposeAs": "$",
"amdId": "jquery"
},
"backbone": {
"exportsTo": "window",
"exportsAs": "Backbone"
},
"bullbone": {
"expose": true,
"exposeAs": "Bull",
"amdId": "bullbone"
},
"handlebars": {
"expose": true,
"exposeAs": "Handlebars"
},
"underscore": {
"expose": true,
"exposeAs": "_",
"amdId": "underscore"
},
"marked": {},
"dompurify": {
"expose": true,
"exposeAs": "DOMPurify"
},
"base64": {
"exportsTo": "window",
"exportsAs": "Base64"
},
"moment": {
"expose": true
}
});