pull/85/head
nightwing 2015-05-03 14:55:08 +04:00
rodzic d2c6ec3c62
commit 68a6a14d90
2 zmienionych plików z 8 dodań i 9 usunięć

Wyświetl plik

@ -10,7 +10,7 @@ define(function(require, module, exports) {
var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter();
var position = -1, mark = null, stack = [];
var position = -1, mark = -2, stack = [];
if (options)
setState(options);
@ -55,7 +55,7 @@ define(function(require, module, exports) {
position = 0;
if (mark < position)
mark = -1;
mark = -2;
emit("change");
}
@ -64,7 +64,7 @@ define(function(require, module, exports) {
stack = stack.slice(0, position + 1);
if (mark > position)
mark = -1;
mark = -2;
if (!noEvent)
emit("change");
@ -91,7 +91,7 @@ define(function(require, module, exports) {
position--;
if (mark == idx)
mark = -1;
mark = -2;
else if (mark > idx)
mark--;
@ -105,8 +105,7 @@ define(function(require, module, exports) {
}
function isAtBookmark(){
return mark !== null && mark == position
|| mark === null && position == -1;
return mark == position;
}
function item(idx) {
@ -133,7 +132,7 @@ define(function(require, module, exports) {
return; // guard against broken stack
stack = state.stack;
emit("change"); //If you remove this again, change the test
emit("change"); // If you remove this again, change the test
}
function findItem(compressedItem) {
@ -146,7 +145,7 @@ define(function(require, module, exports) {
position = -1;
stack = [];
mark = null;
mark = -1;
emit("change");
}

Wyświetl plik

@ -133,7 +133,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
expect(undo.position).to.equal(4);
undo.undo(); check++;
undo.setState({ position : -1, stack : stack, mark : null }); check++;
undo.setState({ position : -1, stack : stack, mark : -1 }); check++;
expect(undo.isAtBookmark()).to.equal(true);
expect(data).to.deep.equal(["a", "q"]);
checkCount();