Properly save search when using "New Saved Search…" menu option
This commit is contained in:
parent
a3a9cb9c1e
commit
1adb8d74f0
2 changed files with 33 additions and 0 deletions
|
@ -946,6 +946,12 @@ var ZoteroPane = new function()
|
|||
Zotero.getString('pane.collections.untitled'));
|
||||
var io = {dataIn: {search: s, name: untitled}, dataOut: null};
|
||||
window.openDialog('chrome://zotero/content/searchDialog.xul','','chrome,modal',io);
|
||||
if (!io.dataOut) {
|
||||
return false;
|
||||
}
|
||||
s.fromJSON(io.dataOut.json);
|
||||
yield s.saveTx();
|
||||
return s.id;
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,33 @@ describe("ZoteroPane", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("#newSearch()", function () {
|
||||
it("should create a saved search", function* () {
|
||||
var promise = waitForDialog(
|
||||
// TODO: Test changing a condition
|
||||
function (dialog) {},
|
||||
'accept',
|
||||
'chrome://zotero/content/searchDialog.xul'
|
||||
);
|
||||
var id = yield zp.newSearch();
|
||||
yield promise;
|
||||
var search = Zotero.Searches.get(id);
|
||||
assert.ok(search);
|
||||
assert.isTrue(search.name.startsWith(Zotero.getString('pane.collections.untitled')));
|
||||
});
|
||||
|
||||
it("should handle clicking Cancel in the search window", function* () {
|
||||
var promise = waitForDialog(
|
||||
function (dialog) {},
|
||||
'cancel',
|
||||
'chrome://zotero/content/searchDialog.xul'
|
||||
);
|
||||
var id = yield zp.newSearch();
|
||||
yield promise;
|
||||
assert.isFalse(id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#itemSelected()", function () {
|
||||
it.skip("should update the item count", function* () {
|
||||
var collection = new Zotero.Collection;
|
||||
|
|
Loading…
Add table
Reference in a new issue