Add test of multiple new insertions with implicit update on the first
This commit is contained in:
parent
bffbe00399
commit
2c136ffbb0
1 changed files with 28 additions and 2 deletions
|
@ -486,8 +486,34 @@ describe("Zotero.Integration", function () {
|
|||
setAddEditItems(testItems[4]);
|
||||
yield execCommand('addEditCitation', docID);
|
||||
assert.equal(doc.fields.length, 3);
|
||||
assert.equal(Zotero.Integration.currentSession.style.registry.registry[testItems[4].id].disambig.year_suffix, '0');
|
||||
assert.equal(Zotero.Integration.currentSession.style.registry.registry[testItems[3].id].disambig.year_suffix, '1');
|
||||
assert.equal(doc.fields[0].text, "(Smith, 2019a)");
|
||||
assert.equal(doc.fields[2].text, "(Smith, 2019b)");
|
||||
});
|
||||
|
||||
it('should place an implicitly updated citation correctly after multiple new insertions', function* () {
|
||||
yield insertMultipleCitations.call(this);
|
||||
var docID = this.test.fullTitle();
|
||||
var doc = applications[docID].doc;
|
||||
|
||||
testItems[3].setCreator(0, {creatorType: 'author', lastName: 'Smith', firstName: 'Robert'});
|
||||
testItems[3].setField('date', '2019-01-01');
|
||||
|
||||
setAddEditItems(testItems[3]);
|
||||
yield execCommand('addEditCitation', docID);
|
||||
assert.equal(doc.fields[2].text, "(Smith, 2019)");
|
||||
|
||||
sinon.stub(doc, 'cursorInField').resolves(doc.fields[0]);
|
||||
sinon.stub(doc, 'canInsertField').resolves(false);
|
||||
|
||||
doc.fields[1].code = doc.fields[0].code;
|
||||
doc.fields[1].text = doc.fields[0].text;
|
||||
|
||||
testItems[4].setCreator(0, {creatorType: 'author', lastName: 'Smith', firstName: 'Robert'});
|
||||
testItems[4].setField('date', '2019-01-01');
|
||||
|
||||
setAddEditItems(testItems[4]);
|
||||
yield execCommand('addEditCitation', docID);
|
||||
assert.equal(doc.fields.length, 3);
|
||||
assert.equal(doc.fields[0].text, "(Smith, 2019a)");
|
||||
assert.equal(doc.fields[2].text, "(Smith, 2019b)");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue