commit 6994c63a0eb1d00f66d3d67606af53dcae1106ef
parent e34bf4d5cbb794f12fbeb05f4316576283583c7a
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 17 Dec 2016 08:01:25 -0500
Tweak recognizePDF fix, add test coverage, and enable manual tests
Still disabled in Travis until we mock the remote services
Diffstat:
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js
@@ -258,7 +258,7 @@ Zotero.Translate.ItemSaver.prototype = {
newAttachment = yield this._saveAttachmentFile.apply(this, arguments);
} else {
Zotero.debug('Translate: Ignoring attachment due to ATTACHMENT_MODE_IGNORE');
- attachmentCallback(attachment, false, e);
+ attachmentCallback(attachment, false);
return false;
}
diff --git a/test/tests/recognizePDFTest.js b/test/tests/recognizePDFTest.js
@@ -1,4 +1,4 @@
-describe.skip("PDF Recognition", function() {
+describe("PDF Recognition", function() {
var win;
before(function* () {
@@ -52,7 +52,7 @@ describe.skip("PDF Recognition", function() {
});
it("should recognize a PDF without a DOI", function* () {
- if (Zotero.automatedTest) this.skip(); // CAPTCHAs make this fail
+ if (Zotero.automatedTest) this.skip(); // TODO: Mock
this.timeout(30000);
// Import the PDF
@@ -65,9 +65,20 @@ describe.skip("PDF Recognition", function() {
// Recognize the PDF
win.Zotero_RecognizePDF.recognizeSelected();
- var ids = yield waitForItemEvent("add");
- var item = Zotero.Items.get(ids[0]);
+ var addedIDs = yield waitForItemEvent("add");
+ var modifiedIDs = yield waitForItemEvent("modify");
+ assert.lengthOf(addedIDs, 1);
+ var item = Zotero.Items.get(addedIDs[0]);
assert.equal(item.getField("title"), "Scaling study of an improved fermion action on quenched lattices");
assert.equal(item.getField("libraryCatalog"), "Google Scholar");
+ assert.lengthOf(modifiedIDs, 2);
+
+ yield Zotero.Promise.delay(0);
+
+ var progressWindow = getWindows("chrome://zotero/content/pdfProgress.xul")[0];
+ assert.equal(
+ progressWindow.document.getElementById("label").value,
+ Zotero.getString("recognizePDF.complete.label")
+ );
});
});
\ No newline at end of file