Fix test breakage from a76493f60
This commit is contained in:
parent
a76493f60d
commit
5e3c7bf63d
2 changed files with 7 additions and 5 deletions
|
@ -3142,7 +3142,7 @@ Zotero.Integration.DocumentData.prototype.unserializeXML = function(xmlData) {
|
||||||
this.prefs[name] = value;
|
this.prefs[name] = value;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.prefs.noteType = parseInt(noteType);
|
this.prefs.noteType = parseInt(this.prefs.noteType);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.prefs.noteType = 0;
|
this.prefs.noteType = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,10 +76,13 @@ describe("Zotero.Integration", function () {
|
||||||
/**
|
/**
|
||||||
* Inserts a field at the given position and initializes the field object.
|
* Inserts a field at the given position and initializes the field object.
|
||||||
* @param {String} fieldType
|
* @param {String} fieldType
|
||||||
* @param {String} noteType
|
* @param {Integer} noteType
|
||||||
* @returns {DocumentPluginDummy.Field}
|
* @returns {DocumentPluginDummy.Field}
|
||||||
*/
|
*/
|
||||||
insertField: function(fieldType, noteType) {
|
insertField: function(fieldType, noteType) {
|
||||||
|
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.fields.push(field);
|
this.fields.push(field);
|
||||||
return field
|
return field
|
||||||
|
@ -274,7 +277,7 @@ describe("Zotero.Integration", function () {
|
||||||
if (items.length == undefined) items = [items];
|
if (items.length == undefined) items = [items];
|
||||||
dialogResults.quickFormat = function(doc, dialogName) {
|
dialogResults.quickFormat = function(doc, dialogName) {
|
||||||
var citationItems = items.map((i) => {return {id: i.id} });
|
var citationItems = items.map((i) => {return {id: i.id} });
|
||||||
var field = doc.insertField();
|
var field = doc.insertField("Field", 0);
|
||||||
field.setCode('TEMP');
|
field.setCode('TEMP');
|
||||||
var integrationDoc = addEditCitationSpy.lastCall.thisValue;
|
var integrationDoc = addEditCitationSpy.lastCall.thisValue;
|
||||||
var fieldGetter = new Zotero.Integration.Fields(integrationDoc._session, integrationDoc._doc, () => 0);
|
var fieldGetter = new Zotero.Integration.Fields(integrationDoc._session, integrationDoc._doc, () => 0);
|
||||||
|
@ -486,7 +489,7 @@ describe("Zotero.Integration", function () {
|
||||||
fieldType: 'ReferenceMark',
|
fieldType: 'ReferenceMark',
|
||||||
storeReferences: true,
|
storeReferences: true,
|
||||||
automaticJournalAbbreviations: true,
|
automaticJournalAbbreviations: true,
|
||||||
noteType: '0'
|
noteType: 0
|
||||||
},
|
},
|
||||||
sessionID: 'F0NFmZ32',
|
sessionID: 'F0NFmZ32',
|
||||||
zoteroVersion: '5.0.SOURCE',
|
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
|
// This isn't ideal, but currently how it works. Better serialization which properly retains types
|
||||||
// coming with official 5.0 release.
|
// coming with official 5.0 release.
|
||||||
data.prefs.noteType = "1";
|
|
||||||
data.dataVersion = "3";
|
data.dataVersion = "3";
|
||||||
|
|
||||||
// Convert to JSON to remove functions from DocumentData objects
|
// Convert to JSON to remove functions from DocumentData objects
|
||||||
|
|
Loading…
Reference in a new issue