New types dont fire events - fixes #155

This commit is contained in:
Kevin Jahns
2019-06-18 17:41:19 +02:00
parent 1faff323c1
commit 1aac245b93
4 changed files with 55 additions and 14 deletions

View File

@@ -210,6 +210,24 @@ export const testInsertAndDeleteEventsForTypes2 = tc => {
compare(users)
}
/**
* This issue has been reported here https://github.com/y-js/yjs/issues/155
* @param {t.TestCase} tc
*/
export const testNewChildDoesNotEmitEventInTransaction = tc => {
const { array0, users } = init(tc, { users: 2 })
let fired = false
users[0].transact(() => {
const newMap = new Y.Map()
newMap.observe(() => {
fired = true
})
array0.insert(0, [newMap])
newMap.set('tst', 42)
})
t.assert(!fired, 'Event does not trigger')
}
/**
* @param {t.TestCase} tc
*/