fixed really nasty bug, requestTransaction was called synchronously

This commit is contained in:
Kevin Jahns
2015-07-17 15:04:00 +02:00
parent 4563ccc98e
commit ebc628adfc
7 changed files with 99 additions and 14 deletions

View File

@@ -123,6 +123,9 @@
if (pos + length > this.idArray.length || pos < 0 || length < 0) {
throw new Error("The deletion range exceeds the range of the array!");
}
if (length === 0) {
return;
}
var eventHandler = this.eventHandler;
var newLeft = pos > 0 ? JSON.parse(this.idArray[pos - 1]) : null;
var dels = [];

View File

@@ -0,0 +1,50 @@
/* @flow */
/*eslint-env browser,jasmine */
describe("TextBind Type", function(){
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
beforeEach(function(done){
createUsers(this, 5, done);
});
describe("debug tests", function(){
it("#1", function(done){
var y = this.users[0].root;
var y2 = this.users[1].root;
var y3 = this.users[2].root;
var c1 = this.users[0].connector;
var c2 = this.users[1].connector;
var c3 = this.users[2].connector;
function flushOneAndTwo(){
c1.flush();
c2.flush();
}
var u1, u2;
y.set("text", Y.TextBind);
flushOneAndTwo();
y.get("text").then(function(array) {
u1 = array;
flushOneAndTwo();
return y2.get("text");
}).then(function(array){
u2 = array;
u1.insert(0, "a");
flushOneAndTwo();
u2.insert(1, "b");
flushOneAndTwo();
u1.insert(2, "c");
flushOneAndTwo();
u2.insert(3, "d");
y3.observe(function(events){
for (var event of events) {
if (event.name === "text") {
y3.get("text");
}
}
});
c3.flush();
done();
});
});
});
});