added not working tests

This commit is contained in:
Kevin Jahns 2015-07-03 14:43:08 +02:00
parent f8ad9abcc0
commit 9d0373b85b
4 changed files with 28 additions and 6 deletions

View File

@ -176,17 +176,17 @@ var Struct = {
}
}
while (true) {
if (o.id !== op.right){
if (o != null && o.id !== op.right){
if (Struct.Insert.getDistanceToOrigin(o) === i) {
// case 1
if (o.id[0] < op.id[0]) {
op.left = o;
op.left = o.id;
distanceToOrigin = i + 1;
}
} else if ((tmp = Struct.Insert.getDistanceToOrigin(o)) < i) {
// case 2
if (i - distanceToOrigin <= tmp) {
op.left = o;
op.left = o.id;
distanceToOrigin = i + 1;
}
} else {

View File

@ -64,4 +64,26 @@ describe("Yjs (basic)", function(){
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);
}
});
});

4
y.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long