fix(dom) bug in Firefox with Imagus extension enabled: change getCurrentName to read from data-name instead of title (#313)

Separated out name generation/parsing logic.
Added test case.
This commit is contained in:
Jacob Henry 2021-01-18 13:42:31 -05:00 committed by coderaiser
parent b6f30d1ccb
commit c057b950c8
9 changed files with 122 additions and 25 deletions

View file

@ -1,31 +0,0 @@
'use strict';
const test = require('supertape');
const stub = require('@cloudcmd/stub');
const btoa = require('../../common/btoa');
test('btoa: browser', (t) => {
const btoaOriginal = global.btoa;
const str = 'hello';
global.btoa = stub();
btoa(str);
t.calledWith(global.btoa, [str], 'should call global.btoa');
t.end();
global.btoa = btoaOriginal;
});
test('btoa: node', (t) => {
const str = 'hello';
const expected = 'aGVsbG8=';
const result = btoa(str);
t.equal(result, expected, 'should encode base64');
t.end();
});

View file

@ -5,7 +5,7 @@
<span data-name="js-date" class="date reduce-text">date</span>
<span data-name="js-owner" class="owner reduce-text">owner</span>
<span data-name="js-mode" class="mode reduce-text">mode</span>
</div><ul data-name="js-files" class="files"><li draggable="true" data-name="js-file-.." class="">
</div><ul data-name="js-files" class="files"><li draggable="true" data-name="js-file-Li4=" class="">
<span data-name="js-type" class="mini-icon directory"></span>
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc" title=".." draggable="true">..</a></span>
<span data-name="js-size" class="size reduce-text">&lt;dir&gt;</span>