From 640aaa15576e23bc85aefe8872c11896c5e7de75 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 13 Mar 2017 15:59:50 -0700 Subject: [PATCH] Add loadPrefPane(paneName) support function E.g., loadPrefPane('sync') to open the prefs and select the 'zotero-pane-sync' pane --- test/content/support.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/content/support.js b/test/content/support.js index 0e70ac5e3..a53346a8c 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -58,6 +58,22 @@ var loadZoteroPane = Zotero.Promise.coroutine(function* (win) { return win; }); +var loadPrefPane = Zotero.Promise.coroutine(function* (paneName) { + var id = 'zotero-prefpane-' + paneName; + var win = yield loadWindow("chrome://zotero/content/preferences/preferences.xul", { + pane: id + }); + var doc = win.document; + var defer = Zotero.Promise.defer(); + var pane = doc.getElementById(id); + if (!pane.loaded) { + pane.addEventListener('paneload', () => defer.resolve()); + yield defer.promise; + } + return win; +}); + + /** * Waits for a window with a specific URL to open. Returns a promise for the window, and * optionally passes the window to a callback immediately for use with modal dialogs,