add unit test for remove to line end
This commit is contained in:
parent
bb84693b0b
commit
8b86c21733
2 changed files with 22 additions and 3 deletions
|
|
@ -205,11 +205,11 @@ module.exports = {
|
||||||
|
|
||||||
assert.equal(this.session.getTextRange(match), "consectetur");
|
assert.equal(this.session.getTextRange(match), "consectetur");
|
||||||
assert.equal(this.session.$selectionOccurrences.length, 2);
|
assert.equal(this.session.$selectionOccurrences.length, 2);
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof module !== "undefined" && module === require.main) {
|
if (typeof module !== "undefined" && module === require.main) {
|
||||||
require("asyncjs").test.testcase(module.exports).exec()
|
require("asyncjs").test.testcase(module.exports).exec();
|
||||||
}
|
}
|
||||||
|
|
@ -489,6 +489,25 @@ module.exports = {
|
||||||
editor.moveCursorTo(1, 2);
|
editor.moveCursorTo(1, 2);
|
||||||
editor.transposeLetters();
|
editor.transposeLetters();
|
||||||
assert.position(editor.getCursorPosition(), 1, 3);
|
assert.position(editor.getCursorPosition(), 1, 3);
|
||||||
|
},
|
||||||
|
|
||||||
|
"test: remove to line end": function() {
|
||||||
|
var session = new EditSession(["123", "4567", "89"]);
|
||||||
|
|
||||||
|
var editor = new Editor(new MockRenderer(), session);
|
||||||
|
editor.moveCursorTo(1, 2);
|
||||||
|
editor.removeToLineEnd();
|
||||||
|
assert.equal(session.getValue(), ["123", "45", "89"].join("\n"));
|
||||||
|
},
|
||||||
|
|
||||||
|
"test: remove to line end at line end should remove the new line": function() {
|
||||||
|
var session = new EditSession(["123", "4567", "89"]);
|
||||||
|
|
||||||
|
var editor = new Editor(new MockRenderer(), session);
|
||||||
|
editor.moveCursorTo(1, 4);
|
||||||
|
editor.removeToLineEnd();
|
||||||
|
assert.position(editor.getCursorPosition(), 1, 4);
|
||||||
|
assert.equal(session.getValue(), ["123", "456789"].join("\n"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue