mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Use Atom::replicate in git spec to simulate project serialization
This commit is contained in:
parent
8b17b7eca9
commit
7b43c8a860
@ -257,7 +257,8 @@ describe "Git", ->
|
||||
|
||||
it "subscribes to all the serialized buffers in the project", ->
|
||||
project.openSync('sample.js')
|
||||
project2 = deserialize(project.serialize())
|
||||
#TODO Replace with atom.replicate().project when Atom is a telepath model
|
||||
project2 = atom.replicate().get('project')
|
||||
buffer = project2.getBuffers()[0]
|
||||
|
||||
waitsFor ->
|
||||
|
@ -317,6 +317,10 @@ class Atom
|
||||
else
|
||||
@windowState
|
||||
|
||||
# Private: Returns a replicated copy of the current state.
|
||||
replicate: ->
|
||||
@windowState.replicate()
|
||||
|
||||
crashMainProcess: ->
|
||||
remote.process.crash()
|
||||
|
||||
|
@ -71,8 +71,7 @@ class Git
|
||||
@refreshStatus()
|
||||
|
||||
if project?
|
||||
@subscribeToBuffer(buffer) for buffer in project.getBuffers()
|
||||
@subscribe project, 'buffer-created', (buffer) => @subscribeToBuffer(buffer)
|
||||
@subscribe project.buffers.onEach (buffer) => @subscribeToBuffer(buffer)
|
||||
|
||||
# Private: Subscribes to buffer events.
|
||||
subscribeToBuffer: (buffer) ->
|
||||
|
@ -34,6 +34,11 @@ class TextBuffer extends Model
|
||||
file: null
|
||||
refcount: 0
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
@loadWhenAttached = @getState()?
|
||||
|
||||
# Private: Called by telepath
|
||||
attached: ->
|
||||
@loaded = false
|
||||
@ -45,6 +50,8 @@ class TextBuffer extends Model
|
||||
|
||||
@setPath(@filePath)
|
||||
|
||||
@load() if @loadWhenAttached
|
||||
|
||||
# Private: Called by telepath
|
||||
beforePersistence: ->
|
||||
@modifiedWhenLastPersisted = @isModified()
|
||||
|
Loading…
Reference in New Issue
Block a user