Z7: Update note editor tests

This commit is contained in:
Dan Stillman 2023-04-27 21:15:56 -04:00
parent 07acfb444a
commit 82b4943d13

View file

@ -26,33 +26,38 @@ describe("Note Editor", function () {
describe("Tags box", function () { describe("Tags box", function () {
it("should open new row for editing if no tags", function* () { it("should open new row for editing if no tags", async function () {
var note = yield createDataObject('item', { itemType: 'note', note: "A" }); var note = await createDataObject('item', { itemType: 'note', note: "A" });
var noteEditor = yield waitForNoteEditor(note); var noteEditor = await waitForNoteEditor(note);
var linksBox = noteEditor._id('links-box'); var linksBox = noteEditor._id('links-box');
linksBox.tagsClick(); linksBox._tagsClickHandler();
var tagsBox = linksBox.id('tagsPopup').firstChild; await Zotero.Promise.delay(100);
var tagRows = tagsBox.id('tagRows'); var tagsBox = linksBox._id('tags-popup').firstChild;
var tagRows = tagsBox._id('rows');
assert.equal(tagRows.childNodes.length, 1); assert.equal(tagRows.childNodes.length, 1);
linksBox.id('tagsPopup').hidePopup(); linksBox._id('tags-popup').hidePopup();
}); });
it("should only open one new row for editing", function* () { it("should only open one new row for editing", async function () {
var note = yield createDataObject('item', { itemType: 'note', note: "B" }); var note = await createDataObject('item', { itemType: 'note', note: "B" });
var noteEditor = yield waitForNoteEditor(note); var noteEditor = await waitForNoteEditor(note);
var linksBox = noteEditor._id('links-box'); var linksBox = noteEditor._id('links-box');
linksBox.tagsClick(); linksBox._tagsClickHandler();
await Zotero.Promise.delay(100);
// Close and reopen // Close and reopen
linksBox.id('tagsPopup').hidePopup(); linksBox._id('tags-popup').hidePopup();
linksBox.tagsClick(); linksBox._tagsClickHandler();
await Zotero.Promise.delay(100);
// Should still be only one empty row // Should still be only one empty row
var tagsBox = linksBox.id('tagsPopup').firstChild; var tagsBox = linksBox._id('tags-popup').firstChild;
var tagRows = tagsBox.id('tagRows'); var tagRows = tagsBox._id('rows');
assert.equal(tagRows.childNodes.length, 1); assert.equal(tagRows.childNodes.length, 1);
linksBox.id('tagsPopup').hidePopup(); linksBox._id('tags-popup').hidePopup();
}); });
it("should show tags in alphabetical order", function* () { it("should show tags in alphabetical order", function* () {
@ -66,7 +71,7 @@ describe("Note Editor", function () {
var noteEditor = yield waitForNoteEditor(note); var noteEditor = yield waitForNoteEditor(note);
var linksBox = noteEditor._id('links-box'); var linksBox = noteEditor._id('links-box');
assert.equal(linksBox.id('tags').summary, "A, B, C"); assert.equal(linksBox._id('tags-value').textContent, "A, B, C");
}); });
}); });
}); });