diff --git a/test/content/runtests.js b/test/content/runtests.js index 1b3d8dc9b7..7e7dc99fd2 100644 --- a/test/content/runtests.js +++ b/test/content/runtests.js @@ -1,6 +1,5 @@ Components.utils.import("resource://gre/modules/FileUtils.jsm"); Components.utils.import("resource://gre/modules/osfile.jsm"); -Components.utils.import("resource://zotero/q.js"); var EventUtils = Components.utils.import("resource://zotero-unit/EventUtils.jsm"); var ZoteroUnit = Components.classes["@mozilla.org/commandlinehandler/general-startup;1?type=zotero-unit"]. @@ -110,6 +109,6 @@ if(run) { window.onload = function() { Zotero.Schema.schemaUpdatePromise.then(function() { mocha.run(); - }).done(); + }); }; } \ No newline at end of file diff --git a/test/content/support.js b/test/content/support.js index 6830bcb79a..2ef920f580 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -3,7 +3,7 @@ * resolved with the event. */ function waitForDOMEvent(target, event, capture) { - var deferred = Q.defer(); + var deferred = Zotero.Promise.defer(); var func = function(ev) { target.removeEventListener("event", func, capture); deferred.resolve(ev); @@ -32,7 +32,7 @@ function loadZoteroPane() { // Hack to wait for pane load to finish. This is the same hack // we use in ZoteroPane.js, so either it's not good enough // there or it should be good enough here. - return Q.delay(52).then(function() { + return Zotero.Promise.delay(52).then(function() { return win; }); }); @@ -42,7 +42,7 @@ function loadZoteroPane() { * Waits for a window with a specific URL to open. Returns a promise for the window. */ function waitForWindow(uri) { - var deferred = Q.defer(); + var deferred = Zotero.Promise.defer(); Components.utils.import("resource://gre/modules/Services.jsm"); var loadobserver = function(ev) { ev.originalTarget.removeEventListener("load", loadobserver, false); @@ -65,7 +65,7 @@ function waitForWindow(uri) { * Waits for a single item event. Returns a promise for the item ID(s). */ function waitForItemEvent(event) { - var deferred = Q.defer(); + var deferred = Zotero.Promise.defer(); var notifierID = Zotero.Notifier.registerObserver({notify:function(ev, type, ids, extraData) { if(ev == event) { Zotero.Notifier.unregisterObserver(notifierID); @@ -97,7 +97,7 @@ function getWindows(uri) { * should assume failure. */ function waitForCallback(cb, interval, timeout) { - var deferred = Q.defer(); + var deferred = Zotero.Promise.defer(); if(interval === undefined) interval = 100; if(timeout === undefined) timeout = 10000; var start = Date.now(); @@ -120,7 +120,7 @@ function waitForCallback(cb, interval, timeout) { */ function installPDFTools() { if(Zotero.Fulltext.pdfConverterIsRegistered() && Zotero.Fulltext.pdfInfoIsRegistered()) { - return Q(true); + return Zotero.Promise.resolve(true); } // Begin install procedure diff --git a/test/tests/recognizePDF.js b/test/tests/recognizePDF.js index 2bbb073685..1533b43cd0 100644 --- a/test/tests/recognizePDF.js +++ b/test/tests/recognizePDF.js @@ -6,7 +6,7 @@ describe("PDF Recognition", function() { this.timeout(60000); // Load Zotero pane, install PDF tools, and load the // translators - return Q.all([loadZoteroPane().then(function(w) { + return Zotero.Promise.all([loadZoteroPane().then(function(w) { win = w; }), installPDFTools()]); });