Skip to content

Commit

Permalink
Add test for deleting same cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
jackycute committed May 14, 2017
1 parent c1d107f commit 670a615
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/phantomjs/test-codemirror-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@
ok(cmAdapter.getValue() === "nanananu");
});

asyncTest("applyOperation should not ignore the next change if this change is a noop", function () {
var doc = "nanana";
var cm = CodeMirror(document.body, { value: doc });
var cmAdapter = new CodeMirrorAdapter(cm);
cmAdapter.registerCallbacks({
change: function () {
ok(true, "change function should be called!");
start();
}
});
// Apply noop
cmAdapter.applyOperation(new TextOperation().retain(5));
// Apply an actual change
CodeMirrorAdapter.applyOperationToCodeMirror(new TextOperation().retain(6).insert("nu"), cm);
ok(cm.getValue() === cmAdapter.getValue());
ok(cmAdapter.getValue() === "nanananu");
});

test("getValue", function () {
var doc = "guten tag";
var cm = CodeMirror(document.body, { value: doc });
Expand Down

0 comments on commit 670a615

Please sign in to comment.