mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
We're using Peer.js to stream changes to shared telepath documents between participants. We're replacing the rootView of joiners in a somewhat hacky way, but replication of pane splits and items is fully tested.
35 lines
1.1 KiB
CoffeeScript
35 lines
1.1 KiB
CoffeeScript
PaneContainer = require 'pane-container'
|
|
Pane = require 'pane'
|
|
{createSite} = require 'telepath'
|
|
|
|
describe "Pane replication", ->
|
|
[editSession1a, editSession1b, container1, pane1, doc1] = []
|
|
[editSession2a, editSession2b, container2, pane2, doc2] = []
|
|
|
|
beforeEach ->
|
|
editSession1a = project.open('sample.js')
|
|
editSession1b = project.open('sample.txt')
|
|
container1 = new PaneContainer
|
|
pane1 = new Pane(editSession1a, editSession1b)
|
|
container1.setRoot(pane1)
|
|
|
|
doc1 = container1.serialize()
|
|
doc2 = doc1.clone(createSite(2))
|
|
doc1.connect(doc2)
|
|
|
|
container2 = deserialize(doc2)
|
|
pane2 = container2.getRoot()
|
|
|
|
it "replicates the initial state of the panes", ->
|
|
expect(pane2.items).toEqual(pane1.items)
|
|
|
|
it "replicates addition and removal of pane items", ->
|
|
pane1.addItem(project.open('css.css'), 1)
|
|
expect(pane2.items).toEqual(pane1.items)
|
|
pane1.removeItemAtIndex(2)
|
|
expect(pane2.items).toEqual(pane1.items)
|
|
|
|
it "replicates the movement of pane items", ->
|
|
pane1.moveItem(editSession1a, 1)
|
|
expect(pane2.items).toEqual(pane1.items)
|