feature(package) supertape v3.10.0

This commit is contained in:
coderaiser 2020-12-21 15:18:42 +02:00
parent 4d8f489b18
commit b18b6af4dc
30 changed files with 86 additions and 84 deletions

View file

@ -28,10 +28,10 @@ module.exports = {
await run(TerminalRun, 'npm run build:client:dev');
CloudCmd.refresh();
},
'P - Build Prod': ({CloudCmd}) => {
'P - Build Prod': async ({CloudCmd}) => {
const {TerminalRun} = CloudCmd;
run(TerminalRun, 'npm run build:client');
await run(TerminalRun, 'npm run build:client');
CloudCmd.refresh();
},
};

View file

@ -18,7 +18,7 @@ const {
// prevent additional loading of emitify
window.Emitify = require('emitify');
module.exports = window.CloudCmd = (config) => {
module.exports = window.CloudCmd = async (config) => {
window.Util = require('../common/util');
window.CloudFunc = require('../common/cloudfunc');
@ -27,7 +27,7 @@ module.exports = window.CloudCmd = (config) => {
window.DOM = DOM;
window.CloudCmd = require('./client');
register(config);
await register(config);
require('./listeners');
require('./key');

View file

@ -24,7 +24,7 @@ test('current-file: setCurrentName: setAttribute', (t) => {
currentFile.setCurrentName('hello', current);
t.ok(setAttribute.calledWith('data-name', 'js-file-aGVsbG8='), 'should call setAttribute');
t.calledWith(setAttribute, ['data-name', 'js-file-aGVsbG8='], 'should call setAttribute');
global.DOM = DOM;
global.CloudCmd = CloudCmd;
@ -46,7 +46,7 @@ test('current-file: setCurrentName: setAttribute: cyrillic', (t) => {
currentFile.setCurrentName('ай', current);
t.ok(setAttribute.calledWith('data-name', 'js-file-JUQwJUIwJUQwJUI5'), 'should call setAttribute');
t.calledWith(setAttribute, ['data-name', 'js-file-JUQwJUIwJUQwJUI5'], 'should call setAttribute');
global.DOM = DOM;
global.CloudCmd = CloudCmd;
@ -71,7 +71,7 @@ test('current-file: emit', (t) => {
currentFile.setCurrentName('hello', current);
t.ok(emit.calledWith('current-file', current), 'should call emit');
t.calledWith(emit, ['current-file', current], 'should call emit');
global.DOM = DOM;
global.CloudCmd = CloudCmd;
@ -164,7 +164,7 @@ test('current-file: isCurrentFile', (t) => {
global.DOM = DOM;
global.CloudCmd = CloudCmd;
t.ok(isContainClass.calledWith(current, _CURRENT_FILE), 'should call isContainClass');
t.calledWith(isContainClass, [current, _CURRENT_FILE], 'should call isContainClass');
t.end();
});
@ -190,7 +190,7 @@ test('current-file: getCurrentType', (t) => {
global.DOM = DOM;
global.CloudCmd = CloudCmd;
t.ok(getByDataName.calledWith('js-type', current));
t.calledWith(getByDataName, ['js-type', current]);
t.end();
});
@ -212,7 +212,7 @@ test('current-file: isCurrentIsDir: getCurrentType', (t) => {
global.DOM = DOM;
global.CloudCmd = CloudCmd;
t.ok(getCurrentType.calledWith(current));
t.calledWith(getCurrentType, [current]);
t.end();
});

View file

@ -25,7 +25,7 @@ test('dom: isContainClass: contains', (t) => {
const className = 'hello';
isContainClass(el, className);
t.ok(contains.calledWith(className), 'should call contains');
t.calledWith(contains, [className], 'should call contains');
t.end();
});
@ -40,7 +40,7 @@ test('dom: isContainClass: contains: array', (t) => {
'hello',
]);
t.ok(contains.calledWith(className), 'should call contains');
t.calledWith(contains, [className], 'should call contains');
t.end();
});

View file

@ -69,8 +69,8 @@ function CmdProto() {
* create new folder
*
*/
this.promptNewDir = function() {
promptNew('directory');
this.promptNewDir = async function() {
await promptNew('directory');
};
/**
@ -79,8 +79,8 @@ function CmdProto() {
* @typeName
* @type
*/
this.promptNewFile = () => {
promptNew('file');
this.promptNewFile = async () => {
await promptNew('file');
};
async function promptNew(typeName) {

View file

@ -22,6 +22,6 @@ test('client: dom: io', (t) => {
url: '/fs/hello?dir',
};
t.ok(sendRequest.calledWith(expected));
t.calledWith(sendRequest, [expected]);
t.end();
});

View file

@ -18,7 +18,7 @@ test('cloudcmd: client: dom: renameCurrent: isCurrentFile', async (t) => {
const renameCurrent = reRequire('./rename-current');
await renameCurrent(current);
t.ok(isCurrentFile.calledWith(current), 'should call isCurrentFile');
t.calledWith(isCurrentFile, [current], 'should call isCurrentFile');
t.end();
});
@ -55,7 +55,7 @@ test('cloudcmd: client: dom: renameCurrent: file exist', async (t) => {
const expected = 'Directory "hello" already exists. Proceed?';
global.CloudCmd = CloudCmd;
t.ok(confirm.calledWith(expected), 'should call confirm');
t.calledWith(confirm, [expected], 'should call confirm');
t.end();
});

View file

@ -17,7 +17,7 @@ test('cloudcmd: client: storage: set', async (t) => {
await storage.set('hello', 'world');
global.localStorage = localStorage;
t.ok(setItem.calledWith('hello', 'world'), 'should call setItem');
t.calledWith(setItem, ['hello', 'world'], 'should call setItem');
t.end();
});
@ -70,7 +70,7 @@ test('cloudcmd: client: storage: setJson', async (t) => {
await storage.setJson('hello', data);
global.localStorage = localStorage;
t.ok(setItem.calledWith('hello', expected));
t.calledWith(setItem, ['hello', expected]);
t.end();
});
@ -85,7 +85,7 @@ test('cloudcmd: client: storage: remove', async (t) => {
await storage.remove('hello');
global.localStorage = localStorage;
t.ok(removeItem.calledWith('hello'), 'should call removeItem');
t.calledWith(removeItem, ['hello'], 'should call removeItem');
t.end();
});

View file

@ -36,7 +36,7 @@ test('cloudcmd: client: key: set next file: no', (t) => {
vim('j', {});
t.ok(setCurrentFile.calledWith(element), 'should set next file');
t.calledWith(setCurrentFile, [element], 'should set next file');
t.end();
});
@ -53,7 +53,7 @@ test('cloudcmd: client: key: set next file current', (t) => {
vim('j', {});
t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file');
t.calledWith(setCurrentFile, [nextSibling], 'should set next file');
t.end();
});
@ -73,7 +73,7 @@ test('cloudcmd: client: key: set next file current', (t) => {
vim('j', {});
vim('j', {});
t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file');
t.calledWith(setCurrentFile, [nextSibling], 'should set next file');
t.end();
});
@ -92,7 +92,7 @@ test('cloudcmd: client: key: set next file current: g', (t) => {
vim('g', {});
vim('j', {});
t.ok(setCurrentFile.calledWith(nextSibling), 'should ignore g');
t.calledWith(setCurrentFile, [nextSibling], 'should ignore g');
t.end();
});
@ -116,7 +116,7 @@ test('cloudcmd: client: key: set +2 file current', (t) => {
vim('2', event);
vim('j', event);
t.ok(setCurrentFile.calledWith(last), 'should set next file');
t.calledWith(setCurrentFile, [last], 'should set next file');
t.end();
});
@ -144,7 +144,7 @@ test('cloudcmd: client: key: select +2 files from current before delete', (t) =>
vim('2', event);
vim('j', event);
t.ok(setCurrentFile.calledWith(last), 'should set next file');
t.calledWith(setCurrentFile, [last], 'should set next file');
t.end();
});
@ -172,7 +172,7 @@ test('cloudcmd: client: key: delete +2 files from current', (t) => {
vim('2', event);
vim('j', event);
t.ok(show.calledWith('delete'), 'should call delete');
t.calledWith(show, ['delete'], 'should call delete');
t.end();
});
@ -190,7 +190,7 @@ test('cloudcmd: client: key: set previous file current', (t) => {
vim('k', {});
t.ok(setCurrentFile.calledWith(previousSibling), 'should set previous file');
t.calledWith(setCurrentFile, [previousSibling], 'should set previous file');
t.end();
});
@ -266,7 +266,7 @@ test('cloudcmd: client: key: selectFile', (t) => {
vim.selectFile(current);
t.ok(selectFile.calledWith(current), 'should call selectFile');
t.calledWith(selectFile, [current], 'should call selectFile');
t.end();
});
@ -286,7 +286,7 @@ test('cloudcmd: client: key: set last file current: shift + g', (t) => {
vim('G', {});
t.ok(setCurrentFile.calledWith(last), 'should set last file');
t.calledWith(setCurrentFile, [last], 'should set last file');
t.end();
});
@ -307,7 +307,7 @@ test('cloudcmd: client: key: set last file current: $', (t) => {
vim('$', {});
t.ok(setCurrentFile.calledWith(last), 'should set last file');
t.calledWith(setCurrentFile, [last], 'should set last file');
t.end();
});
@ -330,7 +330,7 @@ test('cloudcmd: client: key: set first file current: gg', (t) => {
vim('g', {});
vim('g', {});
t.ok(setCurrentFile.calledWith(first), 'should set first file');
t.calledWith(setCurrentFile, [first], 'should set first file');
t.end();
});
@ -352,7 +352,7 @@ test('cloudcmd: client: key: set first file current: ^', (t) => {
vim('^', {});
t.ok(setCurrentFile.calledWith(first), 'should set first file');
t.calledWith(setCurrentFile, [first], 'should set first file');
t.end();
});
@ -368,7 +368,7 @@ test('cloudcmd: client: key: visual', (t) => {
vim('v', {});
t.ok(toggleSelectedFile.calledWith(element), 'should toggle selection');
t.calledWith(toggleSelectedFile, [element], 'should toggle selection');
t.end();
});
@ -403,7 +403,7 @@ test('cloudcmd: client: key: Enter', (t) => {
vim('j');
t.ok(setCurrentFile.calledWith(nextSibling), 'should set next file');
t.calledWith(setCurrentFile, [nextSibling], 'should set next file');
t.end();
});

View file

@ -25,7 +25,7 @@ test('vim: ^', (t) => {
isDelete: false,
};
t.ok(movePrevious.calledWith(expected), 'should call movePrevious');
t.calledWith(movePrevious, [expected], 'should call movePrevious');
t.end();
});
@ -42,7 +42,7 @@ test('vim: w', (t) => {
isDelete: false,
};
t.ok(moveNext.calledWith(expected), 'should call moveNext');
t.calledWith(moveNext, [expected], 'should call moveNext');
t.end();
});
@ -59,7 +59,7 @@ test('vim: b', (t) => {
isDelete: false,
};
t.ok(movePrevious.calledWith(expected), 'should call movePrevious');
t.calledWith(movePrevious, [expected], 'should call movePrevious');
t.end();
});

View file

@ -17,14 +17,16 @@ const {FS} = require('../../common/cloudfunc');
const NBSP_REG = RegExp(String.fromCharCode(160), 'g');
const SPACE = ' ';
module.exports.init = () => {
contextMenu();
dragndrop();
unload();
pop();
resize();
config();
header();
module.exports.init = async () => {
await Promise.all([
contextMenu(),
dragndrop(),
unload(),
pop(),
resize(),
header(),
config(),
]);
};
CloudCmd.Listeners = module.exports;

View file

@ -238,13 +238,13 @@ function onNameChange(name) {
}));
}
function onKey({keyCode, target}) {
async function onKey({keyCode, target}) {
switch(keyCode) {
case Key.ESC:
return hide();
case Key.ENTER:
return onChange(target);
return await onChange(target);
}
}

View file

@ -24,9 +24,9 @@ let MSG_CHANGED;
const isLoading = fullstore();
const ConfigView = {
beforeClose: () => {
beforeClose: async () => {
exec.ifExist(Menu, 'hide');
isChanged();
await isChanged();
},
};

View file

@ -20,10 +20,10 @@ const rename = currify(_rename);
let Menu;
const ConfigView = {
beforeClose: () => {
beforeClose: async () => {
exec.ifExist(Menu, 'hide');
DOM.Events.remove('keydown', keyListener);
isChanged();
await isChanged();
},
};

View file

@ -67,7 +67,7 @@ module.exports.init = promisify((callback) => {
} = CloudCmd;
await loadAll();
initOperations(prefix, prefixSocket, callback);
await initOperations(prefix, prefixSocket, callback);
},
(callback) => {
Loaded = true;

View file

@ -26,6 +26,6 @@ test('cloudcmd: client: polyfill: scrollIntoViewIfNeaded', (t) => {
block: 'nearest',
}];
t.ok(scroll.calledWith(...args), 'should call scrollIntoViewIfNeaded');
t.calledWith(scroll, args, 'should call scrollIntoViewIfNeaded');
t.end();
});

View file

@ -17,7 +17,7 @@ test('cloudcmd: client: user menu: run', async (t) => {
await runSelected(selected, items, runUserMenu);
t.ok(runUserMenu.calledWith(fn));
t.calledWith(runUserMenu, [fn]);
t.end();
});

View file

@ -130,7 +130,7 @@ async function show(data, options) {
return viewImage(prefixURL);
case 'media':
return viewMedia(path);
return await viewMedia(path);
case 'pdf':
return viewPDF(path);

View file

@ -17,7 +17,7 @@ async function registerSW(prefix) {
if (!isHTTPS && !isLocalhost)
return;
return navigator.serviceWorker.register(`${prefix}/sw.js`);
return await navigator.serviceWorker.register(`${prefix}/sw.js`);
}
async function unregisterSW(prefix) {
const reg = await registerSW(prefix);

View file

@ -18,7 +18,7 @@ test('sw: listen', (t) => {
listenSW(sw, 'hello', 'world');
t.ok(addEventListener.calledWith('hello', 'world'), 'should call addEventListener');
t.calledWith(addEventListener, ['hello', 'world'], 'should call addEventListener');
t.end();
});
@ -78,7 +78,7 @@ test('sw: register: registerSW', async (t, {location, navigator}) => {
await registerSW('/hello');
t.ok(register.calledWith('/hello/sw.js'), 'should call register');
t.calledWith(register, ['/hello/sw.js'], 'should call register');
t.end();
});
@ -94,7 +94,7 @@ test('sw: register: unregisterSW', async (t, {location, navigator}) => {
await unregisterSW('/hello');
t.ok(register.calledWith('/hello/sw.js'), 'should call register');
t.calledWith(register, ['/hello/sw.js'], 'should call register');
t.end();
});

View file

@ -215,7 +215,7 @@
"smalltalk": "^4.0.0",
"style-loader": "^1.0.0",
"supermenu": "^4.0.1",
"supertape": "^3.1.3",
"supertape": "^3.10.0",
"tar-stream": "^2.0.0",
"unionfs": "^4.0.0",
"url-loader": "^4.0.0",

View file

@ -157,7 +157,7 @@ function listen(manage, sock, auth) {
});
}
function _middle(manage, req, res, next) {
async function _middle(manage, req, res, next) {
const noConfigDialog = !manage('configDialog');
if (req.url !== `${apiURL}/config`)
@ -174,7 +174,7 @@ function _middle(manage, req, res, next) {
.status(404)
.send('Config is disabled');
patch(manage, req, res);
await patch(manage, req, res);
break;
default:

View file

@ -9,7 +9,7 @@ test('cloudcmd: exit: process.exit', (t) => {
process.exit = stub();
exit();
t.ok(process.exit.calledWith(1), 'should call process.exit');
t.calledWith(process.exit, [1], 'should call process.exit');
process.exit = exitOriginal;
t.end();
@ -23,7 +23,7 @@ test('cloudcmd: exit: console.error', (t) => {
process.exit = stub();
exit('hello world');
t.ok(console.error.calledWith('hello world'), 'should call console.error');
t.calledWith(console.error, ['hello world'], 'should call console.error');
process.exit = exitOriginal;
console.error = error;
@ -39,7 +39,7 @@ test('cloudcmd: exit.error: console.error: error', (t) => {
process.exit = stub();
exit(Error('hello world'));
t.ok(console.error.calledWith('hello world'), 'should call console.error');
t.calledWith(console.error, ['hello world'], 'should call console.error');
process.exit = exitOriginal;
console.error = error;

View file

@ -26,10 +26,10 @@ module.exports = callbackify(async (name, rootDir, request) => {
switch(method) {
case 'GET':
return onGET(request, name, rootDir);
return await onGET(request, name, rootDir);
case 'PUT':
return onPUT(request);
return await onPUT(request);
}
});

View file

@ -29,7 +29,7 @@ test('cloudcmd: root: mellow', (t) => {
mockRequire.stopAll(pathConfig);
reRequire(pathRoot);
t.ok(pathToWin.calledWith(dir, dirRoot), 'should call mellow');
t.calledWith(pathToWin, [dir, dirRoot], 'should call mellow');
t.end();
});

View file

@ -38,7 +38,7 @@ test('cloudcmd: terminal: enabled', (t) => {
const terminal = require(terminalPath);
terminal(arg);
t.ok(term.calledWith(arg), 'should call terminal');
t.calledWith(term, [arg], 'should call terminal');
t.end();
});

View file

@ -33,7 +33,7 @@ test('validate: root: config', (t) => {
validate.root('/hello', config);
t.ok(config.calledWith('dropbox'), 'should call config');
t.calledWith(config, ['dropbox'], 'should call config');
t.end();
});
@ -64,7 +64,7 @@ test('validate: root: stat', (t) => {
fs.statSync = statSync;
mockRequire.stop(exitPath);
t.ok(fn.calledWith(msg, error), 'should call fn');
t.calledWith(fn, [msg, error], 'should call fn');
t.end();
});
@ -80,7 +80,7 @@ test('validate: packer: not valid', (t) => {
mockRequire.stop(exitPath);
t.ok(fn.calledWith(msg), 'should call fn');
t.calledWith(fn, [msg], 'should call fn');
t.end();
});
@ -96,7 +96,7 @@ test('validate: editor: not valid', (t) => {
mockRequire.stop(exitPath);
t.ok(fn.calledWith(msg), 'should call fn');
t.calledWith(fn, [msg], 'should call fn');
t.end();
});
@ -131,7 +131,7 @@ test('validate: columns: wrong', (t) => {
mockRequire.stop(exitPath);
mockRequire.stop(columnsPath);
t.ok(fn.calledWith(msg), 'should call exit');
t.calledWith(fn, [msg], 'should call exit');
t.end();
});

View file

@ -41,7 +41,7 @@ test('cloudcmd: static: user menu: IO.write', async (t) => {
});
const path = '/.cloudcmd.menu.js';
t.ok(write.calledWith(path, _data), 'should call IO.write');
t.calledWith(write, [path, _data], 'should call IO.write');
t.end();
});
@ -72,7 +72,7 @@ test('cloudcmd: static: user menu: setCurrentByName', async (t) => {
});
const fileName = '.cloudcmd.menu.js';
t.ok(setCurrentByName.calledWith(fileName), 'should call DOM.setCurrentByName');
t.calledWith(setCurrentByName, [fileName], 'should call DOM.setCurrentByName');
t.end();
});
@ -120,7 +120,7 @@ test('cloudcmd: static: user menu: compare directories', async (t) => {
});
const {files} = DOM.CurrentInfo.files;
t.ok(DOM.getFilenames.calledWith(files), 'should call getFilenames');
t.calledWith(DOM.getFilenames, [files], 'should call getFilenames');
t.end();
});
@ -138,7 +138,7 @@ test('cloudcmd: static: user menu: compare directories: select names', (t) => {
getCurrentByName,
});
t.ok(selectFile.calledWith(file), 'should call selectFile');
t.calledWith(selectFile, [file], 'should call selectFile');
t.end();
});
@ -156,7 +156,7 @@ test('cloudcmd: static: user menu: compare directories: select names: getCurrent
getCurrentByName,
});
t.ok(getCurrentByName.calledWith(name, panel), 'should call selectFile');
t.calledWith(getCurrentByName, [name, panel], 'should call selectFile');
t.end();
});

View file

@ -13,7 +13,7 @@ test('btoa: browser', (t) => {
btoa(str);
t.ok(global.btoa.calledWith(str), 'should call global.btoa');
t.calledWith(global.btoa, [str], 'should call global.btoa');
t.end();
global.btoa = btoaOriginal;

View file

@ -74,7 +74,7 @@ test('cloudcmd: modules: no', (t) => {
fn({url}, {send});
t.ok(send.calledWith(localModules), 'should have been called with modules');
t.calledWith(send, [localModules], 'should have been called with modules');
t.end();
});