Skip to content
Snippets Groups Projects
Commit 9d0373b8 authored by Kevin Jahns's avatar Kevin Jahns
Browse files

added not working tests

parent f8ad9abc
No related branches found
No related tags found
No related merge requests found
...@@ -176,17 +176,17 @@ var Struct = { ...@@ -176,17 +176,17 @@ var Struct = {
} }
} }
while (true) { while (true) {
if (o.id !== op.right){ if (o != null && o.id !== op.right){
if (Struct.Insert.getDistanceToOrigin(o) === i) { if (Struct.Insert.getDistanceToOrigin(o) === i) {
// case 1 // case 1
if (o.id[0] < op.id[0]) { if (o.id[0] < op.id[0]) {
op.left = o; op.left = o.id;
distanceToOrigin = i + 1; distanceToOrigin = i + 1;
} }
} else if ((tmp = Struct.Insert.getDistanceToOrigin(o)) < i) { } else if ((tmp = Struct.Insert.getDistanceToOrigin(o)) < i) {
// case 2 // case 2
if (i - distanceToOrigin <= tmp) { if (i - distanceToOrigin <= tmp) {
op.left = o; op.left = o.id;
distanceToOrigin = i + 1; distanceToOrigin = i + 1;
} }
} else { } else {
......
...@@ -64,4 +64,26 @@ describe("Yjs (basic)", function(){ ...@@ -64,4 +64,26 @@ describe("Yjs (basic)", function(){
u.transact(transaction); u.transact(transaction);
} }
}); });
it("Basic get&set of Map property (handle conflict)", function(){
var y = this.users[0];
y.connector.flushAll();
this.users[0].transact(function*(root){
yield* root.val("stuff", "c0");
});
this.users[1].transact(function*(root){
yield* root.val("stuff", "c1");
});
var transaction = function*(root){
expect(yield* root.val("stuff")).toEqual("c1");
};
y.connector.flushAll();
for (var key in this.users) {
var u = this.users[key];
u.transact(transaction);
}
});
}); });
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment