Compare commits

...

2 commits

Author SHA1 Message Date
coderaiser
d83958edea chore(package) v15.3.2 2021-01-18 14:19:03 +02:00
coderaiser
7603fe2bdd fix(client) dom: goToDirectory 2021-01-18 14:08:14 +02:00
6 changed files with 837 additions and 803 deletions

View file

@ -1,3 +1,9 @@
2021.01.18, v15.3.2
fix:
- (client) dom: goToDirectory
2021.01.17, v15.3.1 2021.01.17, v15.3.1
fix: fix:

View file

@ -1,4 +1,4 @@
# Cloud Commander v15.3.1 # Cloud Commander v15.3.2
### [Main][MainURL] [Blog][BlogURL] Live(![Heroku][Heroku_LIVE_IMG] [Heroku][HerokuURL]) ### [Main][MainURL] [Blog][BlogURL] Live(![Heroku][Heroku_LIVE_IMG] [Heroku][HerokuURL])

View file

@ -1,4 +1,4 @@
# Cloud Commander v15.3.1 [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Codacy][CodacyIMG]][CodacyURL] [![Gitter][GitterIMGURL]][GitterURL] # Cloud Commander v15.3.2 [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Codacy][CodacyIMG]][CodacyURL] [![Gitter][GitterIMGURL]][GitterURL]
### [Main][MainURL] [Blog][BlogURL] Live([Heroku][HerokuURL]) ### [Main][MainURL] [Blog][BlogURL] Live([Heroku][HerokuURL])

View file

@ -19,12 +19,15 @@ const renameCurrent = require('./operations/rename-current');
const CurrentFile = require('./current-file'); const CurrentFile = require('./current-file');
const DOMTree = require('./dom-tree'); const DOMTree = require('./dom-tree');
const Cmd = module.exports;
const DOM = { const DOM = {
...DOMTree, ...DOMTree,
...CurrentFile, ...CurrentFile,
...new CmdProto(), ...Cmd,
}; };
const CurrentInfo = {};
DOM.Images = Images; DOM.Images = Images;
DOM.load = load; DOM.load = load;
DOM.Files = Files; DOM.Files = Files;
@ -32,6 +35,7 @@ DOM.RESTful = RESTful;
DOM.IO = IO; DOM.IO = IO;
DOM.Storage = Storage; DOM.Storage = Storage;
DOM.Dialog = Dialog; DOM.Dialog = Dialog;
DOM.CurrentInfo = CurrentInfo;
module.exports = DOM; module.exports = DOM;
@ -42,48 +46,44 @@ DOM.Events = require('./events');
const loadRemote = require('./load-remote'); const loadRemote = require('./load-remote');
const selectByPattern = require('./select-by-pattern'); const selectByPattern = require('./select-by-pattern');
function CmdProto() { const SELECTED_FILE = 'selected-file';
const CurrentInfo = {}; const TabPanel = {
const Cmd = this;
const SELECTED_FILE = 'selected-file';
const TabPanel = {
'js-left' : null, 'js-left' : null,
'js-right' : null, 'js-right' : null,
}; };
this.loadRemote = (name, options, callback) => { module.exports.loadRemote = (name, options, callback) => {
loadRemote(name, options, callback); loadRemote(name, options, callback);
return DOM; return DOM;
}; };
this.loadSocket = function(callback) { module.exports.loadSocket = (callback) => {
DOM.loadRemote('socket', { DOM.loadRemote('socket', {
name : 'io', name : 'io',
}, callback); }, callback);
return DOM; return DOM;
}; };
/** /**
* create new folder * create new folder
* *
*/ */
this.promptNewDir = async function() { module.exports.promptNewDir = async function() {
await promptNew('directory'); await promptNew('directory');
}; };
/** /**
* create new file * create new file
* *
* @typeName * @typeName
* @type * @type
*/ */
this.promptNewFile = async () => { module.exports.promptNewFile = async () => {
await promptNew('file'); await promptNew('file');
}; };
async function promptNew(typeName) { async function promptNew(typeName) {
const {Dialog} = DOM; const {Dialog} = DOM;
const dir = DOM.getCurrentDirPath(); const dir = DOM.getCurrentDirPath();
const msg = 'New ' + typeName || 'File'; const msg = 'New ' + typeName || 'File';
@ -112,12 +112,12 @@ function CmdProto() {
await CloudCmd.refresh({ await CloudCmd.refresh({
currentName, currentName,
}); });
} }
/** /**
* get current direcotory name * get current direcotory name
*/ */
this.getCurrentDirName = () => { module.exports.getCurrentDirName = () => {
const href = DOM.getCurrentDirPath() const href = DOM.getCurrentDirPath()
.replace(/\/$/, ''); .replace(/\/$/, '');
@ -125,12 +125,12 @@ function CmdProto() {
const ret = href.replace(substr + '/', '') || '/'; const ret = href.replace(substr + '/', '') || '/';
return ret; return ret;
}; };
/** /**
* get current direcotory path * get current direcotory path
*/ */
this.getParentDirPath = (panel) => { module.exports.getParentDirPath = (panel) => {
const path = DOM.getCurrentDirPath(panel); const path = DOM.getCurrentDirPath(panel);
const dirName = DOM.getCurrentDirName() + '/'; const dirName = DOM.getCurrentDirName() + '/';
const index = path.lastIndexOf(dirName); const index = path.lastIndexOf(dirName);
@ -139,55 +139,55 @@ function CmdProto() {
return path.slice(0, index); return path.slice(0, index);
return path; return path;
}; };
/** /**
* get not current direcotory path * get not current direcotory path
*/ */
this.getNotCurrentDirPath = () => { module.exports.getNotCurrentDirPath = () => {
const panel = DOM.getPanel({active: false}); const panel = DOM.getPanel({active: false});
const path = DOM.getCurrentDirPath(panel); const path = DOM.getCurrentDirPath(panel);
return path; return path;
}; };
/** /**
* get current file by name * get current file by name
*/ */
this.getCurrentByName = (name, panel = CurrentInfo.panel) => { module.exports.getCurrentByName = (name, panel = CurrentInfo.panel) => {
const dataName = 'js-file-' + btoa(encodeURI(name)); const dataName = 'js-file-' + btoa(encodeURI(name));
const element = DOM.getByDataName(dataName, panel); const element = DOM.getByDataName(dataName, panel);
return element; return element;
}; };
/** /**
* unified way to get selected files * unified way to get selected files
* *
* @currentFile * @currentFile
*/ */
this.getSelectedFiles = () => { module.exports.getSelectedFiles = () => {
const panel = DOM.getPanel(); const panel = DOM.getPanel();
const selected = DOM.getByClassAll(SELECTED_FILE, panel); const selected = DOM.getByClassAll(SELECTED_FILE, panel);
return Array.from(selected); return Array.from(selected);
}; };
/* /*
* unselect all files * unselect all files
*/ */
this.unselectFiles = (files) => { module.exports.unselectFiles = (files) => {
files = files || DOM.getSelectedFiles(); files = files || DOM.getSelectedFiles();
Array.from(files).forEach(DOM.toggleSelectedFile); Array.from(files).forEach(DOM.toggleSelectedFile);
}; };
/** /**
* get all selected files or current when none selected * get all selected files or current when none selected
* *
* @currentFile * @currentFile
*/ */
this.getActiveFiles = () => { module.exports.getActiveFiles = () => {
const current = DOM.getCurrentFile(); const current = DOM.getCurrentFile();
const files = DOM.getSelectedFiles(); const files = DOM.getSelectedFiles();
const name = DOM.getCurrentName(current); const name = DOM.getCurrentName(current);
@ -196,22 +196,22 @@ function CmdProto() {
return [current]; return [current];
return files; return files;
}; };
this.getCurrentDate = (currentFile) => { module.exports.getCurrentDate = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const date = DOM const date = DOM
.getByDataName('js-date', current) .getByDataName('js-date', current)
.textContent; .textContent;
return date; return date;
}; };
/** /**
* get size * get size
* @currentFile * @currentFile
*/ */
this.getCurrentSize = (currentFile) => { module.exports.getCurrentSize = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
/* если это папка - возвращаем слово dir вместо размера*/ /* если это папка - возвращаем слово dir вместо размера*/
const size = DOM.getByDataName('js-size', current) const size = DOM.getByDataName('js-size', current)
@ -219,13 +219,13 @@ function CmdProto() {
.replace(/^<|>$/g, ''); .replace(/^<|>$/g, '');
return size; return size;
}; };
/** /**
* get size * get size
* @currentFile * @currentFile
*/ */
this.loadCurrentSize = async (currentFile) => { module.exports.loadCurrentSize = async (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const query = '?size'; const query = '?size';
const link = DOM.getCurrentPath(current); const link = DOM.getCurrentPath(current);
@ -241,76 +241,76 @@ function CmdProto() {
Images.hide(); Images.hide();
return current; return current;
}; };
/** /**
* load hash * load hash
* @callback * @callback
* @currentFile * @currentFile
*/ */
this.loadCurrentHash = async (currentFile) => { module.exports.loadCurrentHash = async (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const query = '?hash'; const query = '?hash';
const link = DOM.getCurrentPath(current); const link = DOM.getCurrentPath(current);
const [, data] = await RESTful.read(link + query); const [, data] = await RESTful.read(link + query);
return data; return data;
}; };
/** /**
* load current modification time of file * load current modification time of file
* @callback * @callback
* @currentFile * @currentFile
*/ */
this.loadCurrentTime = async (currentFile) => { module.exports.loadCurrentTime = async (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const query = '?time'; const query = '?time';
const link = DOM.getCurrentPath(current); const link = DOM.getCurrentPath(current);
const [, data] = await RESTful.read(link + query); const [, data] = await RESTful.read(link + query);
return data; return data;
}; };
/** /**
* set size * set size
* @currentFile * @currentFile
*/ */
this.setCurrentSize = (size, currentFile) => { module.exports.setCurrentSize = (size, currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const sizeElement = DOM.getByDataName('js-size', current); const sizeElement = DOM.getByDataName('js-size', current);
sizeElement.textContent = size; sizeElement.textContent = size;
}; };
/** /**
* @currentFile * @currentFile
*/ */
this.getCurrentMode = (currentFile) => { module.exports.getCurrentMode = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const mode = DOM.getByDataName('js-mode', current); const mode = DOM.getByDataName('js-mode', current);
return mode.textContent; return mode.textContent;
}; };
/** /**
* @currentFile * @currentFile
*/ */
this.getCurrentOwner = (currentFile) => { module.exports.getCurrentOwner = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const owner = DOM.getByDataName('js-owner', current); const owner = DOM.getByDataName('js-owner', current);
return owner.textContent; return owner.textContent;
}; };
const mixArgs = (f) => (a, b) => f(b, a); const mixArgs = (f) => (a, b) => f(b, a);
/** /**
* unified way to get current file content * unified way to get current file content
* *
* @param callback * @param callback
* @param currentFile * @param currentFile
*/ */
this.getCurrentData = callbackify(mixArgs(async (callback, currentFile) => { module.exports.getCurrentData = callbackify(mixArgs(async (callback, currentFile) => {
const {Dialog} = DOM; const {Dialog} = DOM;
const Info = DOM.CurrentInfo; const Info = DOM.CurrentInfo;
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
@ -348,36 +348,36 @@ function CmdProto() {
await DOM.saveDataToStorage(path, data, hashNew); await DOM.saveDataToStorage(path, data, hashNew);
return data; return data;
})); }));
/** /**
* unified way to get RefreshButton * unified way to get RefreshButton
*/ */
this.getRefreshButton = (panel = DOM.getPanel()) => { module.exports.getRefreshButton = (panel = DOM.getPanel()) => {
return DOM.getByDataName('js-refresh', panel); return DOM.getByDataName('js-refresh', panel);
}; };
/** /**
* select current file * select current file
* @param currentFile * @param currentFile
*/ */
this.selectFile = (currentFile) => { module.exports.selectFile = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
current.classList.add(SELECTED_FILE); current.classList.add(SELECTED_FILE);
return Cmd; return Cmd;
}; };
this.unselectFile = (currentFile) => { module.exports.unselectFile = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
current.classList.remove(SELECTED_FILE); current.classList.remove(SELECTED_FILE);
return Cmd; return Cmd;
}; };
this.toggleSelectedFile = (currentFile) => { module.exports.toggleSelectedFile = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const name = DOM.getCurrentName(current); const name = DOM.getCurrentName(current);
@ -387,21 +387,21 @@ function CmdProto() {
current.classList.toggle(SELECTED_FILE); current.classList.toggle(SELECTED_FILE);
return Cmd; return Cmd;
}; };
this.toggleAllSelectedFiles = () => { module.exports.toggleAllSelectedFiles = () => {
DOM.getAllFiles().map(DOM.toggleSelectedFile); DOM.getAllFiles().map(DOM.toggleSelectedFile);
return Cmd; return Cmd;
}; };
this.selectAllFiles = () => { module.exports.selectAllFiles = () => {
DOM.getAllFiles().map(DOM.selectFile); DOM.getAllFiles().map(DOM.selectFile);
return Cmd; return Cmd;
}; };
this.getAllFiles = () => { module.exports.getAllFiles = () => {
const panel = DOM.getPanel(); const panel = DOM.getPanel();
const files = DOM.getFiles(panel); const files = DOM.getFiles(panel);
const name = DOM.getCurrentName(files[0]); const name = DOM.getCurrentName(files[0]);
@ -410,32 +410,32 @@ function CmdProto() {
const i = from(name); const i = from(name);
return Array.from(files).slice(i); return Array.from(files).slice(i);
}; };
/** /**
* open dialog with expand selection * open dialog with expand selection
*/ */
this.expandSelection = () => { module.exports.expandSelection = () => {
const msg = 'expand'; const msg = 'expand';
const {files} = CurrentInfo; const {files} = CurrentInfo;
selectByPattern(msg, files); selectByPattern(msg, files);
}; };
/** /**
* open dialog with shrink selection * open dialog with shrink selection
*/ */
this.shrinkSelection = () => { module.exports.shrinkSelection = () => {
const msg = 'shrink'; const msg = 'shrink';
const {files} = CurrentInfo; const {files} = CurrentInfo;
selectByPattern(msg, files); selectByPattern(msg, files);
}; };
/** /**
* setting history wrapper * setting history wrapper
*/ */
this.setHistory = (data, title, url) => { module.exports.setHistory = (data, title, url) => {
const ret = window.history; const ret = window.history;
const {prefix} = CloudCmd; const {prefix} = CloudCmd;
@ -445,33 +445,33 @@ function CmdProto() {
history.pushState(data, title, url); history.pushState(data, title, url);
return ret; return ret;
}; };
/** /**
* selected file check * selected file check
* *
* @param currentFile * @param currentFile
*/ */
this.isSelected = (selected) => { module.exports.isSelected = (selected) => {
if (!selected) if (!selected)
return false; return false;
return DOM.isContainClass(selected, SELECTED_FILE); return DOM.isContainClass(selected, SELECTED_FILE);
}; };
/** /**
* get link from current (or param) file * get link from current (or param) file
* *
* @param currentFile - current file by default * @param currentFile - current file by default
*/ */
this.getCurrentLink = (currentFile) => { module.exports.getCurrentLink = (currentFile) => {
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const link = DOM.getByTag('a', current); const link = DOM.getByTag('a', current);
return link[0]; return link[0];
}; };
this.getFilenames = (files) => { module.exports.getFilenames = (files) => {
if (!files) if (!files)
throw Error('AllFiles could not be empty'); throw Error('AllFiles could not be empty');
@ -488,12 +488,12 @@ function CmdProto() {
}); });
return names; return names;
}; };
/** /**
* check storage hash * check storage hash
*/ */
this.checkStorageHash = async (name) => { module.exports.checkStorageHash = async (name) => {
const nameHash = name + '-hash'; const nameHash = name + '-hash';
if (typeof name !== 'string') if (typeof name !== 'string')
@ -508,9 +508,9 @@ function CmdProto() {
throw error; throw error;
return [loadHash, storeHash]; return [loadHash, storeHash];
}; };
/** /**
* save data to storage * save data to storage
* *
* @param name * @param name
@ -518,7 +518,7 @@ function CmdProto() {
* @param hash * @param hash
* @param callback * @param callback
*/ */
this.saveDataToStorage = async (name, data, hash) => { module.exports.saveDataToStorage = async (name, data, hash) => {
const isDir = DOM.isCurrentIsDir(); const isDir = DOM.isCurrentIsDir();
if (isDir) if (isDir)
@ -533,22 +533,22 @@ function CmdProto() {
await Storage.set(nameData, data); await Storage.set(nameData, data);
return hash; return hash;
}; };
this.getFM = () => { module.exports.getFM = () => {
return DOM.getPanel().parentElement; return DOM.getPanel().parentElement;
}; };
this.getPanelPosition = (panel) => { module.exports.getPanelPosition = (panel) => {
panel = panel || DOM.getPanel(); panel = panel || DOM.getPanel();
return panel.dataset.name.replace('js-', ''); return panel.dataset.name.replace('js-', '');
}; };
/** function getting panel active, or passive /** function getting panel active, or passive
* @param options = {active: true} * @param options = {active: true}
*/ */
this.getPanel = (options) => { module.exports.getPanel = (options) => {
let files; let files;
let panel; let panel;
let isLeft; let isLeft;
@ -581,17 +581,17 @@ function CmdProto() {
throw Error('can not find Active Panel!'); throw Error('can not find Active Panel!');
return panel; return panel;
}; };
this.getFiles = (element) => { module.exports.getFiles = (element) => {
const files = DOM.getByDataName('js-files', element); const files = DOM.getByDataName('js-files', element);
return files.children || []; return files.children || [];
}; };
/** /**
* shows panel right or left (or active) * shows panel right or left (or active)
*/ */
this.showPanel = (active) => { module.exports.showPanel = (active) => {
const panel = DOM.getPanel({active}); const panel = DOM.getPanel({active});
if (!panel) if (!panel)
@ -600,12 +600,12 @@ function CmdProto() {
DOM.show(panel); DOM.show(panel);
return true; return true;
}; };
/** /**
* hides panel right or left (or active) * hides panel right or left (or active)
*/ */
this.hidePanel = (active) => { module.exports.hidePanel = (active) => {
const panel = DOM.getPanel({ const panel = DOM.getPanel({
active, active,
}); });
@ -614,27 +614,27 @@ function CmdProto() {
return false; return false;
return DOM.hide(panel); return DOM.hide(panel);
}; };
/** /**
* remove child of element * remove child of element
* @param pChild * @param pChild
* @param element * @param element
*/ */
this.remove = (child, element) => { module.exports.remove = (child, element) => {
const parent = element || document.body; const parent = element || document.body;
parent.removeChild(child); parent.removeChild(child);
return DOM; return DOM;
}; };
/** /**
* remove current file from file table * remove current file from file table
* @param current * @param current
* *
*/ */
this.deleteCurrent = (current) => { module.exports.deleteCurrent = (current) => {
if (!current) if (!current)
DOM.getCurrentFile(); DOM.getCurrentFile();
@ -648,52 +648,52 @@ function CmdProto() {
DOM.setCurrentFile(next || prev); DOM.setCurrentFile(next || prev);
parent.removeChild(current); parent.removeChild(current);
} }
}; };
/** /**
* remove selected files from file table * remove selected files from file table
* @Selected * @Selected
*/ */
this.deleteSelected = (selected) => { module.exports.deleteSelected = (selected) => {
selected = selected || DOM.getSelectedFiles(); selected = selected || DOM.getSelectedFiles();
if (!selected) if (!selected)
return; return;
selected.map(DOM.deleteCurrent); selected.map(DOM.deleteCurrent);
}; };
/** /**
* rename current file * rename current file
* *
* @currentFile * @currentFile
*/ */
this.renameCurrent = renameCurrent; module.exports.renameCurrent = renameCurrent;
/** /**
* unified way to scrollIntoViewIfNeeded * unified way to scrollIntoViewIfNeeded
* (native suporte by webkit only) * (native suporte by webkit only)
* @param element * @param element
* @param center - to scroll as small as possible param should be false * @param center - to scroll as small as possible param should be false
*/ */
this.scrollIntoViewIfNeeded = function(element, center = false) { module.exports.scrollIntoViewIfNeeded = (element, center = false) => {
if (!element || !element.scrollIntoViewIfNeeded) if (!element || !element.scrollIntoViewIfNeeded)
return; return;
element.scrollIntoViewIfNeeded(center); element.scrollIntoViewIfNeeded(center);
}; };
/* scroll on one page */ /* scroll on one page */
this.scrollByPages = (element, pPages) => { module.exports.scrollByPages = (element, pPages) => {
const ret = element?.scrollByPages && pPages; const ret = element?.scrollByPages && pPages;
if (ret) if (ret)
element.scrollByPages(pPages); element.scrollByPages(pPages);
return ret; return ret;
}; };
this.changePanel = () => { module.exports.changePanel = () => {
const Info = CurrentInfo; const Info = CurrentInfo;
let panel = DOM.getPanel(); let panel = DOM.getPanel();
@ -739,16 +739,16 @@ function CmdProto() {
CloudCmd.emit('active-dir', Info.dirPath); CloudCmd.emit('active-dir', Info.dirPath);
return DOM; return DOM;
}; };
this.getPackerExt = (type) => { module.exports.getPackerExt = (type) => {
if (type === 'zip') if (type === 'zip')
return '.zip'; return '.zip';
return '.tar.gz'; return '.tar.gz';
}; };
this.goToDirectory = async () => { module.exports.goToDirectory = async () => {
const msg = 'Go to directory:'; const msg = 'Go to directory:';
const {Dialog} = DOM; const {Dialog} = DOM;
const {dirPath} = CurrentInfo; const {dirPath} = CurrentInfo;
@ -756,7 +756,7 @@ function CmdProto() {
const [ const [
cancel, cancel,
path = dirPath, path = dirPath,
] = await Dialog.prompt(msg, path); ] = await Dialog.prompt(msg, dirPath);
if (cancel) if (cancel)
return; return;
@ -764,9 +764,9 @@ function CmdProto() {
await CloudCmd.loadDir({ await CloudCmd.loadDir({
path, path,
}); });
}; };
this.duplicatePanel = async () => { module.exports.duplicatePanel = async () => {
const Info = CurrentInfo; const Info = CurrentInfo;
const {isDir} = Info; const {isDir} = Info;
const panel = Info.panelPassive; const panel = Info.panelPassive;
@ -786,9 +786,9 @@ function CmdProto() {
panel, panel,
noCurrent, noCurrent,
}); });
}; };
this.swapPanels = async () => { module.exports.swapPanels = async () => {
const Info = CurrentInfo; const Info = CurrentInfo;
const { const {
panel, panel,
@ -821,11 +821,11 @@ function CmdProto() {
const el = Info.files[currentIndex]; const el = Info.files[currentIndex];
DOM.setCurrentFile(el); DOM.setCurrentFile(el);
}; };
this.CurrentInfo = CurrentInfo; module.exports.CurrentInfo = CurrentInfo;
this.updateCurrentInfo = (currentFile) => { module.exports.updateCurrentInfo = (currentFile) => {
const info = DOM.CurrentInfo; const info = DOM.CurrentInfo;
const current = currentFile || DOM.getCurrentFile(); const current = currentFile || DOM.getCurrentFile();
const files = current.parentElement; const files = current.parentElement;
@ -863,6 +863,4 @@ function CmdProto() {
info.isOnePanel = info.isOnePanel =
info.panel.getAttribute('data-name') === info.panel.getAttribute('data-name') ===
info.panelPassive.getAttribute('data-name'); info.panelPassive.getAttribute('data-name');
}; };
}

30
client/dom/index.spec.js Normal file
View file

@ -0,0 +1,30 @@
'use strict';
require('css-modules-require-hook');
const {test, stub} = require('supertape');
const mockRequire = require('mock-require');
const {reRequire} = mockRequire;
global.CloudCmd = {};
test('cloudcmd: client: dom: goToDirectory', async (t) => {
const path = '';
const {CloudCmd} = global;
const loadDir = stub();
const prompt = stub().returns([null, path]);
CloudCmd.loadDir = loadDir;
mockRequire('./dialog', {
prompt,
});
const {goToDirectory} = reRequire('.');
await goToDirectory();
t.calledWith(loadDir, [{path}]);
t.end();
});

View file

@ -1,6 +1,6 @@
{ {
"name": "cloudcmd", "name": "cloudcmd",
"version": "15.3.1", "version": "15.3.2",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
"description": "File manager for the web with console and editor", "description": "File manager for the web with console and editor",
"homepage": "http://cloudcmd.io", "homepage": "http://cloudcmd.io",