commit 5e3c7bf63d3b5c00fed03c1da97fe5bb338b7db3
parent a76493f60dd41dacf1adefb06c807c18d2c387ff
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date: Tue, 2 May 2017 15:09:12 +0300
Fix test breakage from a76493f60
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js
@@ -3142,7 +3142,7 @@ Zotero.Integration.DocumentData.prototype.unserializeXML = function(xmlData) {
this.prefs[name] = value;
}
try {
- this.prefs.noteType = parseInt(noteType);
+ this.prefs.noteType = parseInt(this.prefs.noteType);
} catch (e) {
this.prefs.noteType = 0;
}
diff --git a/test/tests/integrationTest.js b/test/tests/integrationTest.js
@@ -76,10 +76,13 @@ describe("Zotero.Integration", function () {
/**
* Inserts a field at the given position and initializes the field object.
* @param {String} fieldType
- * @param {String} noteType
+ * @param {Integer} noteType
* @returns {DocumentPluginDummy.Field}
*/
insertField: function(fieldType, noteType) {
+ if (typeof noteType != "number") {
+ throw new Error("noteType must be an integer");
+ }
var field = new DocumentPluginDummy.Field(this);
this.fields.push(field);
return field
@@ -274,7 +277,7 @@ describe("Zotero.Integration", function () {
if (items.length == undefined) items = [items];
dialogResults.quickFormat = function(doc, dialogName) {
var citationItems = items.map((i) => {return {id: i.id} });
- var field = doc.insertField();
+ var field = doc.insertField("Field", 0);
field.setCode('TEMP');
var integrationDoc = addEditCitationSpy.lastCall.thisValue;
var fieldGetter = new Zotero.Integration.Fields(integrationDoc._session, integrationDoc._doc, () => 0);
@@ -486,7 +489,7 @@ describe("Zotero.Integration", function () {
fieldType: 'ReferenceMark',
storeReferences: true,
automaticJournalAbbreviations: true,
- noteType: '0'
+ noteType: 0
},
sessionID: 'F0NFmZ32',
zoteroVersion: '5.0.SOURCE',
@@ -546,7 +549,6 @@ describe("Zotero.Integration", function () {
// This isn't ideal, but currently how it works. Better serialization which properly retains types
// coming with official 5.0 release.
- data.prefs.noteType = "1";
data.dataVersion = "3";
// Convert to JSON to remove functions from DocumentData objects