www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 37fa0c203fb74a6245f6d98702a0350e340f02bc
parent 6336a30cb94f679e2d57efeb6ecf6782483b884e
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date:   Wed,  3 May 2017 14:34:00 +0300

Write sessionID into the doc on new session creation

Diffstat:
Mchrome/content/zotero/xpcom/integration.js | 2++
Mtest/tests/integrationTest.js | 4++--
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -1032,6 +1032,8 @@ Zotero.Integration.Document.prototype._getSession = Zotero.Promise.coroutine(fun this._session = this._createNewSession(data); try { yield this._session.setData(data); + // this._createNewSession() updates sessionID, which we need to store back into the doc + this._doc.setDocumentData(me._session.data.serialize()) } catch(e) { // make sure style is defined if(e instanceof Zotero.Exception.Alert && e.name === "integration.error.invalidStyle") { diff --git a/test/tests/integrationTest.js b/test/tests/integrationTest.js @@ -352,10 +352,10 @@ describe("Zotero.Integration", function () { assert.isFalse(setDocumentDataSpy.called); }); - it('should not call doc.setDocumentData when document communicates for first time since restart, but has data', function* () { + it('should call doc.setDocumentData when document communicates for first time since restart to write new sessionID', function* () { Zotero.Integration.sessions = {}; yield execCommand('addEditCitation', docID); - assert.isFalse(setDocumentDataSpy.called); + assert.isTrue(setDocumentDataSpy.calledOnce); }); describe('when style used in the document does not exist', function() {