Created
November 26, 2021 17:49
-
-
Save nc/f1ab3957350434f7387671b0b4b9ae5e to your computer and use it in GitHub Desktop.
Failing test case for #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Y from 'yjs'; | |
import { proxy } from 'valtio/vanilla'; | |
import { bindProxyAndYMap } from '../src/index'; | |
describe('issue #14', () => { | |
it('nested map direct set', async () => { | |
const doc = new Y.Doc(); | |
const p = proxy({ items: { item1: { color: 'blue' } } }); | |
const m = doc.getMap('map'); | |
bindProxyAndYMap(p, m); | |
p.items.item1.color = 'red'; | |
await Promise.resolve(); | |
expect(m.get('items').get('item1').get('color')).toStrictEqual('red'); | |
}); | |
it('nested map 1 level outer set', async () => { | |
const doc = new Y.Doc(); | |
const p = proxy({ items: { item1: { color: 'blue' } } }); | |
const m = doc.getMap('map'); | |
bindProxyAndYMap(p, m); | |
p.items.item1 = { color: 'red' }; | |
await Promise.resolve(); | |
expect(m.get('items').get('item1').get('color')).toStrictEqual('red'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment