mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(cloudcmd) cyrillic symbols in names
This commit is contained in:
parent
88acb4c9a8
commit
5acf252c45
6 changed files with 30 additions and 6 deletions
|
|
@ -34,7 +34,7 @@ module.exports.setCurrentName = (name, current) => {
|
|||
link.href = dir + encoded;
|
||||
link.innerHTML = encoded;
|
||||
|
||||
current.setAttribute('data-name', 'js-file-' + btoa(name));
|
||||
current.setAttribute('data-name', 'js-file-' + btoa(encodeURI(name)));
|
||||
CloudCmd.emit('current-file', current);
|
||||
|
||||
return link;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,30 @@ test('current-file: setCurrentName: setAttribute', (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('current-file: setCurrentName: setAttribute: cyrillic', (t) => {
|
||||
const {
|
||||
DOM,
|
||||
CloudCmd,
|
||||
} = global;
|
||||
|
||||
global.DOM = getDOM();
|
||||
global.CloudCmd = getCloudCmd();
|
||||
|
||||
const setAttribute = sinon.stub();
|
||||
const current = {
|
||||
setAttribute
|
||||
};
|
||||
|
||||
currentFile.setCurrentName('ай', current);
|
||||
|
||||
t.ok(setAttribute.calledWith('data-name', 'js-file-JUQwJUIwJUQwJUI5'), 'should call setAttribute');
|
||||
|
||||
global.DOM = DOM;
|
||||
global.CloudCmd = CloudCmd;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('current-file: emit', (t) => {
|
||||
const {
|
||||
DOM,
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ function CmdProto() {
|
|||
* get current file by name
|
||||
*/
|
||||
this.getCurrentByName = (name, panel = CurrentInfo.panel) => {
|
||||
const dataName = 'js-file-' + btoa(name);
|
||||
const dataName = 'js-file-' + btoa(encodeURI(name));
|
||||
const element = DOM.getByDataName(dataName, panel);
|
||||
|
||||
return element;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ function getPathLink(url, prefix, template) {
|
|||
}
|
||||
|
||||
const getDataName = (name) => {
|
||||
const encoded = btoa(name);
|
||||
const encoded = btoa(encodeURI(name));
|
||||
return `data-name="js-file-${encoded}" `;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
<span data-name="js-date" class="date reduce-text">21.02.2016</span>
|
||||
<span data-name="js-owner" class="owner reduce-text">root</span>
|
||||
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
|
||||
</li><li draggable="true" data-name="js-file-cHJlZmRt" class="">
|
||||
</li><li draggable="true" data-name="js-file-JUQwJUIwJUQwJUI5" class="">
|
||||
<span data-name="js-type" class="mini-icon text-file"></span>
|
||||
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/prefdm" title="prefdm" target="_blank" draggable="true">prefdm</a></span>
|
||||
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/ай" title="ай" target="_blank" draggable="true">ай</a></span>
|
||||
<span data-name="js-size" class="size reduce-text">1.30kb</span>
|
||||
<span data-name="js-date" class="date reduce-text">--.--.----</span>
|
||||
<span data-name="js-owner" class="owner reduce-text">root</span>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ const JSON_FILES = {
|
|||
uid : 0,
|
||||
mode: 'rwx r-x r-x'
|
||||
}, {
|
||||
name: 'prefdm',
|
||||
name: 'ай',
|
||||
size: '1.30kb',
|
||||
date: 0,
|
||||
uid : 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue