mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 10:09:04 +00:00
chore: cloudcmd
This commit is contained in:
parent
6e778a35ba
commit
4b84d20bb0
17 changed files with 121 additions and 132 deletions
|
|
@ -14,7 +14,7 @@ export const createCloudMenu = async (fm, options, menuData) => {
|
|||
|
||||
async function loadMenu() {
|
||||
if (CloudCmd.config('menu') === 'aleman') {
|
||||
const {host, protocol} = window.location;
|
||||
const {host, protocol} = globalThis.location;
|
||||
const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;
|
||||
const {createMenu} = await import(/* webpackIgnore: true */url);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const loadAll = async () => {
|
|||
const [e] = await tryToCatch(load.parallel, [js, css]);
|
||||
|
||||
if (e) {
|
||||
const src = e.target.src.replace(window.location.href, '');
|
||||
const src = e.target.src.replace(globalThis.location.href, '');
|
||||
return Dialog.alert(`file ${src} could not be loaded`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const loadAll = async () => {
|
|||
const [e] = await tryToCatch(loadParallel, [js, css]);
|
||||
|
||||
if (e) {
|
||||
const src = e.target.src.replace(window.location.href, '');
|
||||
const src = e.target.src.replace(globalThis.location.href, '');
|
||||
return Dialog.alert(`file ${src} could not be loaded`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,12 +22,9 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
|
|||
headers: [],
|
||||
});
|
||||
|
||||
const originalFetch = global.fetch;
|
||||
|
||||
global.fetch = fetch;
|
||||
globalThis.fetch = fetch;
|
||||
await _detectType('/hello');
|
||||
|
||||
global.fetch = originalFetch;
|
||||
const expected = ['/hello', {
|
||||
method: 'HEAD',
|
||||
}];
|
||||
|
|
@ -37,17 +34,13 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
|
|||
});
|
||||
|
||||
test('cloudcmd: client: view: types: detectType: found', async (t) => {
|
||||
const originalFetch = global.fetch;
|
||||
|
||||
global.fetch = stub().returns({
|
||||
globalThis.fetch = stub().returns({
|
||||
headers: [
|
||||
['content-type', 'image/png'],
|
||||
],
|
||||
});
|
||||
const result = await _detectType('/hello');
|
||||
|
||||
global.fetch = originalFetch;
|
||||
|
||||
t.equal(result, '.png');
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue