diff --git a/test/tests/data/apa.csl b/test/tests/data/apa.csl
new file mode 100644
index 0000000000..09f4635a50
--- /dev/null
+++ b/test/tests/data/apa.csl
@@ -0,0 +1,1900 @@
+
+
diff --git a/test/tests/data/cell.csl b/test/tests/data/cell.csl
deleted file mode 100644
index 1262840da6..0000000000
--- a/test/tests/data/cell.csl
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
diff --git a/test/tests/integrationTest.js b/test/tests/integrationTest.js
index bae0be58bd..91780c32ee 100644
--- a/test/tests/integrationTest.js
+++ b/test/tests/integrationTest.js
@@ -44,7 +44,7 @@ describe("Zotero.Integration", function () {
/**
* The Document class corresponds to a single word processing document.
*/
- DocumentPluginDummy.Document = function() {this.fields = []};
+ DocumentPluginDummy.Document = function() {this.fields = [], this.fieldIdx = 0};
DocumentPluginDummy.Document.prototype = {
/**
* Displays a dialog in the word processing application
@@ -96,7 +96,7 @@ describe("Zotero.Integration", function () {
if (typeof noteType != "number") {
throw new Error("noteType must be an integer");
}
- var field = new DocumentPluginDummy.Field(this);
+ var field = new DocumentPluginDummy.Field(this, this.fieldIdx++);
this.fields.push(field);
return field;
},
@@ -179,12 +179,13 @@ describe("Zotero.Integration", function () {
* The Field class corresponds to a field containing an individual citation
* or bibliography
*/
- DocumentPluginDummy.Field = function(doc) {
+ DocumentPluginDummy.Field = function(doc, idx) {
this.doc = doc;
this.code = '';
// This is actually required and current integration code depends on text being non-empty upon insertion.
// insertBibliography will fail if there is no placeholder text.
this.text = '{Placeholder}';
+ this.idx = idx;
this.wrappedJSObject = this;
};
DocumentPluginDummy.Field.noteIndex = 0;
@@ -243,7 +244,12 @@ describe("Zotero.Integration", function () {
let method = DocumentPluginDummy[cls].prototype[methodName];
DocumentPluginDummy[cls].prototype[methodName] = async function() {
try {
- Zotero.debug(`DocumentPluginDummy: ${cls}.${methodName} invoked with args ${JSON.stringify(arguments)}`, 2);
+ if (cls == 'Field') {
+ Zotero.debug(`DocumentPluginDummy: ${cls}[${this.idx}].${methodName} invoked with args ${JSON.stringify(arguments)}`, 2);
+ }
+ else {
+ Zotero.debug(`DocumentPluginDummy: ${cls}.${methodName} invoked with args ${JSON.stringify(arguments)}`, 2);
+ }
} catch (e) {
Zotero.debug(`DocumentPluginDummy: ${cls}.${methodName} invoked with args ${arguments}`, 2);
}
@@ -262,8 +268,8 @@ describe("Zotero.Integration", function () {
var testItems;
var applications = {};
var addEditCitationSpy, displayDialogStub;
- var styleID = "http://www.zotero.org/styles/cell";
- var stylePath = OS.Path.join(getTestDataDirectory().path, 'cell.csl');
+ var styleID = "http://www.zotero.org/styles/apa";
+ var stylePath = OS.Path.join(getTestDataDirectory().path, 'apa.csl');
var commandList = [
'addCitation', 'editCitation', 'addEditCitation',
@@ -306,7 +312,7 @@ describe("Zotero.Integration", function () {
function setDefaultIntegrationDocPrefs() {
dialogResults.integrationDocPrefs = {
- style: "http://www.zotero.org/styles/cell",
+ style: styleID,
locale: 'en-US',
fieldType: 'Field',
automaticJournalAbbreviations: false,
@@ -528,7 +534,7 @@ describe("Zotero.Integration", function () {
var doc = applications[docID].doc;
testItems[3].setCreator(0, {creatorType: 'author', lastName: 'Smith', firstName: 'Robert'});
- testItems[3].setField('date', '2019-01-01');
+ testItems[3].setField('date', '2019-01-02');
setAddEditItems(testItems[3]);
yield execCommand('addEditCitation', docID);
@@ -553,7 +559,7 @@ describe("Zotero.Integration", function () {
var doc = applications[docID].doc;
testItems[3].setCreator(0, {creatorType: 'author', lastName: 'Smith', firstName: 'Robert'});
- testItems[3].setField('date', '2019-01-01');
+ testItems[3].setField('date', '2019-01-02');
setAddEditItems(testItems[3]);
yield execCommand('addEditCitation', docID);
@@ -620,7 +626,7 @@ describe("Zotero.Integration", function () {
yield execCommand('addEditCitation', docID);
assert.equal(getCiteprocBibliographySpy.lastCall.returnValue[0].entry_ids.length, 3);
- assert.equal(getCiteprocBibliographySpy.lastCall.returnValue[1][0], "Aaaaa Bbbbb.");
+ assert.equal(getCiteprocBibliographySpy.lastCall.returnValue[1][0], "Aaaaa. (n.d.). {\\i{}Bbbbb}.");
getCiteprocBibliographySpy.restore();
});
@@ -936,11 +942,11 @@ describe("Zotero.Integration", function () {
describe("DocumentData", function() {
it('should properly unserialize old XML document data', function() {
- var serializedXMLData = "