force that transactions that apply document updates are set as non-local transatctions. Fixes #307
This commit is contained in:
parent
c72ac448e9
commit
71d8da6513
@ -380,6 +380,8 @@ export const writeStructsFromTransaction = (encoder, transaction) => writeClient
|
||||
*/
|
||||
export const readUpdateV2 = (decoder, ydoc, transactionOrigin, structDecoder = new UpdateDecoderV2(decoder)) =>
|
||||
transact(ydoc, transaction => {
|
||||
// force that transaction.local is set to non-local
|
||||
transaction.local = false
|
||||
let retry = false
|
||||
const doc = transaction.doc
|
||||
const store = doc.store
|
||||
|
@ -455,6 +455,44 @@ export const testSplitSurrogateCharacter = tc => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search marker bug https://github.com/yjs/yjs/issues/307
|
||||
*
|
||||
* @param {t.TestCase} tc
|
||||
*/
|
||||
export const testSearchMarkerBug1 = tc => {
|
||||
const { users, text0, text1, testConnector } = init(tc, { users: 2 })
|
||||
|
||||
users[0].on('update', update => {
|
||||
users[0].transact(() => {
|
||||
Y.applyUpdate(users[0], update)
|
||||
})
|
||||
})
|
||||
users[0].on('update', update => {
|
||||
users[1].transact(() => {
|
||||
Y.applyUpdate(users[1], update)
|
||||
})
|
||||
})
|
||||
|
||||
text0.insert(0, 'a_a')
|
||||
testConnector.flushAllMessages()
|
||||
text0.insert(2, 's')
|
||||
testConnector.flushAllMessages()
|
||||
text1.insert(3, 'd')
|
||||
testConnector.flushAllMessages()
|
||||
text0.delete(0, 5)
|
||||
testConnector.flushAllMessages()
|
||||
text0.insert(0, 'a_a')
|
||||
testConnector.flushAllMessages()
|
||||
text0.insert(2, 's')
|
||||
testConnector.flushAllMessages()
|
||||
text1.insert(3, 'd')
|
||||
testConnector.flushAllMessages()
|
||||
t.compareStrings(text0.toString(), text1.toString())
|
||||
t.compareStrings(text0.toString(), 'a_sda')
|
||||
compare(users)
|
||||
}
|
||||
|
||||
// RANDOM TESTS
|
||||
|
||||
let charCounter = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user