Refactor utilities code in preparation to move to external repo
This commit is contained in:
parent
e0bc873bce
commit
c929055571
15 changed files with 368 additions and 461 deletions
|
@ -468,4 +468,49 @@ describe("Zotero.Utilities.Internal", function () {
|
|||
assert.equal(Zotero.Utilities.Internal.getNextName('Name 2', existing, true), 'Name 4');
|
||||
});
|
||||
});
|
||||
|
||||
describe("#parseURL()", function () {
|
||||
var f;
|
||||
before(() => {
|
||||
f = Zotero.Utilities.Internal.parseURL;
|
||||
});
|
||||
|
||||
describe("#fileName", function () {
|
||||
it("should contain filename", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/def.html?foo=bar'), 'fileName', 'def.html');
|
||||
});
|
||||
|
||||
it("should be empty if no filename", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/'), 'fileName', '');
|
||||
});
|
||||
});
|
||||
|
||||
describe("#fileExtension", function () {
|
||||
it("should contain extension", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/def.html?foo=bar'), 'fileExtension', 'html');
|
||||
});
|
||||
|
||||
it("should be empty if no extension", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/def'), 'fileExtension', '');
|
||||
});
|
||||
|
||||
it("should be empty if no filename", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/'), 'fileExtension', '');
|
||||
});
|
||||
});
|
||||
|
||||
describe("#fileBaseName", function () {
|
||||
it("should contain base name", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/def.html?foo=bar'), 'fileBaseName', 'def');
|
||||
});
|
||||
|
||||
it("should equal filename if no extension", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/def'), 'fileBaseName', 'def');
|
||||
});
|
||||
|
||||
it("should be empty if no filename", function () {
|
||||
assert.propertyVal(f('http://example.com/abc/'), 'fileBaseName', '');
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue