Fix test failure after 94c4445475

If the styled textbox (i.e., TinyMCE) isn't initialized, .value now
returns null instead of throwing.
This commit is contained in:
Dan Stillman 2017-08-30 18:22:00 -04:00
parent 05d74c4cac
commit 91ef561474

View File

@ -257,23 +257,18 @@ describe("Item pane", function () {
var item = new Zotero.Item('note');
var id = yield item.saveTx();
var noteEditor = doc.getElementById('zotero-note-editor');
// Wait for the editor
var noteBox = doc.getElementById('zotero-note-editor');
var val = false;
do {
try {
val = noteBox.noteField.value;
}
catch (e) {}
yield Zotero.Promise.delay(1);
}
while (val === false)
assert.equal(noteBox.noteField.value, '');
yield new Zotero.Promise((resolve, reject) => {
noteEditor.noteField.onInit(() => resolve());
})
assert.equal(noteEditor.noteField.value, '');
item.setNote('<p>Test</p>');
yield item.saveTx();
assert.equal(noteBox.noteField.value, '<p>Test</p>');
assert.equal(noteEditor.noteField.value, '<p>Test</p>');
})
})