Fix test for opening the Cite prefpane when clicking Manage Styles…

This commit is contained in:
Dan Stillman 2023-04-15 01:23:04 -04:00
parent 085a271b6c
commit 40fd9e8759

View file

@ -12,7 +12,7 @@ describe("Create Bibliography Dialog", function () {
win.close(); win.close();
}); });
it("should perform a search", async function () { it("should open the Cite prefpane when Manage Styles… is clicked", async function () {
await Zotero.Styles.init(); await Zotero.Styles.init();
var item = await createDataObject('item'); var item = await createDataObject('item');
@ -20,16 +20,13 @@ describe("Create Bibliography Dialog", function () {
var called = false; var called = false;
waitForWindow("chrome://zotero/content/bibliography.xhtml", function (dialog) { waitForWindow("chrome://zotero/content/bibliography.xhtml", function (dialog) {
waitForWindow("chrome://zotero/content/preferences/preferences.xhtml", function (window) { waitForWindow("chrome://zotero/content/preferences/preferences.xhtml", function (window) {
// Wait for pane switch // Wait for switch to Cite pane
(async function () { (async function () {
do { do {
Zotero.debug("Checking for pane"); Zotero.debug("Checking for pane");
await Zotero.Promise.delay(5); await Zotero.Promise.delay(5);
} }
while (window.document.documentElement.currentPane.id != 'zotero-prefpane-cite'); while (!window.document.querySelector('[value=zotero-prefpane-cite]').selected);
let pane = window.document.documentElement.currentPane;
assert.equal(pane.getElementsByTagName('tabbox')[0].selectedTab.id, 'styles-tab');
assert.equal(pane.getElementsByTagName('tabbox')[0].selectedPanel.id, 'styles');
called = true; called = true;
window.close(); window.close();
deferred.resolve(); deferred.resolve();