From 8db49fc08dcddaabaa804d5e7a839e0927c2828e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 15 Dec 2015 17:20:01 +0100 Subject: [PATCH] :white_check_mark: Document existing behavior --- spec/tokenized-buffer-spec.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 76314681c..e617c7956 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -38,6 +38,21 @@ describe "TokenizedBuffer", -> expect(tokenizedBufferB.buffer).toBe(tokenizedBufferA.buffer) + it "does not serialize / deserialize the current grammar", -> + buffer = atom.project.bufferForPathSync('sample.js') + tokenizedBufferA = new TokenizedBuffer({ + buffer, config: atom.config, grammarRegistry: atom.grammars, packageManager: atom.packages, assert: atom.assert + }) + autoSelectedGrammar = tokenizedBufferA.grammar + + tokenizedBufferA.setGrammar(atom.grammars.grammarForScopeName('source.coffee')) + tokenizedBufferB = TokenizedBuffer.deserialize( + JSON.parse(JSON.stringify(tokenizedBufferA.serialize())), + atom + ) + + expect(tokenizedBufferB.grammar).toBe(autoSelectedGrammar) + describe "when the underlying buffer has no path", -> it "deserializes it searching among the buffers in the current project", -> buffer = atom.project.bufferForPathSync(null)