Remove obsolete Zotero.Libraries.isFilesEditable test after 88184b341
This commit is contained in:
parent
0a1629e986
commit
3ba2b40c4c
2 changed files with 9 additions and 33 deletions
|
@ -162,42 +162,9 @@ describe("Zotero.Libraries", function() {
|
|||
});
|
||||
});
|
||||
describe("#isFilesEditable()", function() {
|
||||
it("should always return true for user library", function() {
|
||||
assert.isTrue(Zotero.Libraries.isFilesEditable(Zotero.Libraries.userLibraryID));
|
||||
});
|
||||
it("should always return true for publications library", function() {
|
||||
assert.isTrue(Zotero.Libraries.isFilesEditable(Zotero.Libraries.publicationsLibraryID));
|
||||
});
|
||||
it("should throw for invalid library ID", function() {
|
||||
assert.throws(Zotero.Libraries.isFilesEditable.bind(Zotero.Libraries, -1), /^Invalid library ID /);
|
||||
});
|
||||
|
||||
it("should not depend on editable", function* () {
|
||||
let editableStartState = Zotero.Libraries.isEditable(group.libraryID),
|
||||
filesEditableStartState = Zotero.Libraries.isFilesEditable(group.libraryID);
|
||||
|
||||
// Test all combinations
|
||||
// E: true, FE: true => true
|
||||
yield Zotero.Libraries.setEditable(group.libraryID, true);
|
||||
yield Zotero.Libraries.setFilesEditable(group.libraryID, true);
|
||||
assert.isTrue(Zotero.Libraries.isFilesEditable(group.libraryID));
|
||||
|
||||
// E: false, FE: true => true
|
||||
yield Zotero.Libraries.setEditable(group.libraryID, false);
|
||||
assert.isTrue(Zotero.Libraries.isFilesEditable(group.libraryID));
|
||||
|
||||
// E: false, FE: false => false
|
||||
yield Zotero.Libraries.setFilesEditable(group.libraryID, false);
|
||||
assert.isFalse(Zotero.Libraries.isFilesEditable(group.libraryID));
|
||||
|
||||
// E: true, FE: false => false
|
||||
yield Zotero.Libraries.setEditable(group.libraryID, true);
|
||||
assert.isFalse(Zotero.Libraries.isFilesEditable(group.libraryID));
|
||||
|
||||
// Revert settings
|
||||
yield Zotero.Libraries.setFilesEditable(group.libraryID, filesEditableStartState);
|
||||
yield Zotero.Libraries.setEditable(group.libraryID, editableStartState);
|
||||
});
|
||||
});
|
||||
describe("#setFilesEditable()", function() {
|
||||
it("should not allow changing files editable state of built-in libraries", function* () {
|
||||
|
|
|
@ -102,6 +102,14 @@ describe("Zotero.Library", function() {
|
|||
});
|
||||
|
||||
describe("#filesEditable", function() {
|
||||
it("should always return true for user library", function() {
|
||||
assert.isTrue(Zotero.Libraries.userLibrary.filesEditable);
|
||||
});
|
||||
|
||||
it("should always return true for publications library", function() {
|
||||
assert.isTrue(Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID).filesEditable);
|
||||
});
|
||||
|
||||
it("should return files editable status", function() {
|
||||
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
|
||||
assert.isTrue(library.filesEditable, 'user library is files editable');
|
||||
|
@ -118,6 +126,7 @@ describe("Zotero.Library", function() {
|
|||
assert.isFalse(library.filesEditable);
|
||||
assert.isFalse(Zotero.Libraries.isFilesEditable(library.libraryID), "sets files editable in cache to false");
|
||||
});
|
||||
|
||||
it("should not be settable for user and publications libraries", function* () {
|
||||
let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);
|
||||
assert.throws(function() {library.filesEditable = false}, /^Cannot change _libraryFilesEditable for user library$/, "does not allow setting user library as not files editable");
|
||||
|
|
Loading…
Add table
Reference in a new issue