commit 6dfdae870e5fc6e3f408c7384582d258f8f145e7
parent a91151756bfce558cb4913c47784ad1b21c32ec4
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 13 Apr 2015 03:27:51 -0400
Q -> Bluebird in tests
Diffstat:
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git 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
@@ -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
@@ -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()]);
});