update tests since move lines up/down does not modify selection anymore
This commit is contained in:
parent
f6d88bc10c
commit
1a4fb3ffcf
1 changed files with 26 additions and 27 deletions
|
|
@ -248,7 +248,7 @@ module.exports = {
|
|||
assert.range(editor.getSelectionRange(), 0, 3, 1, 0);
|
||||
},
|
||||
|
||||
"test: move lines down should select moved lines" : function() {
|
||||
"test: move lines down should keep selection on moved lines" : function() {
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
|
||||
|
|
@ -257,25 +257,25 @@ module.exports = {
|
|||
|
||||
editor.moveLinesDown();
|
||||
assert.equal(["33", "11", "22", "44"].join("\n"), session.toString());
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
|
||||
assert.position(editor.getCursorPosition(), 2, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 2, 1);
|
||||
|
||||
editor.moveLinesDown();
|
||||
assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
|
||||
assert.position(editor.getCursorPosition(), 2, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 2);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 2, 0);
|
||||
assert.position(editor.getCursorPosition(), 3, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 2, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 3, 1);
|
||||
|
||||
// moving again should have no effect
|
||||
editor.moveLinesDown();
|
||||
assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
|
||||
assert.position(editor.getCursorPosition(), 2, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 2);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 2, 0);
|
||||
assert.position(editor.getCursorPosition(), 3, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 2, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 3, 1);
|
||||
},
|
||||
|
||||
"test: move lines up should select moved lines" : function() {
|
||||
"test: move lines up should keep selection on moved lines" : function() {
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
|
||||
|
|
@ -284,19 +284,18 @@ module.exports = {
|
|||
|
||||
editor.moveLinesUp();
|
||||
assert.equal(session.toString(), ["11", "33", "44", "22"].join("\n"));
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
|
||||
assert.position(editor.getCursorPosition(), 2, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 2, 1);
|
||||
|
||||
editor.moveLinesUp();
|
||||
assert.equal(session.toString(), ["33", "44", "11", "22"].join("\n"));
|
||||
assert.position(editor.getCursorPosition(), 0, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 2, 0);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 0, 0);
|
||||
assert.position(editor.getCursorPosition(), 1, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 0, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 1, 1);
|
||||
},
|
||||
|
||||
"test: move line without active selection should not move cursor relative to the moved line" : function()
|
||||
{
|
||||
"test: move line without active selection should not move cursor relative to the moved line" : function() {
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
|
||||
|
|
@ -314,7 +313,7 @@ module.exports = {
|
|||
assert.position(editor.getCursorPosition(), 1, 1);
|
||||
},
|
||||
|
||||
"test: copy lines down should select lines and place cursor at the selection start" : function() {
|
||||
"test: copy lines down should keep selection" : function() {
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
|
||||
|
|
@ -324,12 +323,12 @@ module.exports = {
|
|||
editor.copyLinesDown();
|
||||
assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
|
||||
|
||||
assert.position(editor.getCursorPosition(), 3, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 5, 0);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 3, 0);
|
||||
assert.position(editor.getCursorPosition(), 4, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 4, 1);
|
||||
},
|
||||
|
||||
"test: copy lines up should select lines and place cursor at the selection start" : function() {
|
||||
"test: copy lines up should keep selection" : function() {
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
|
||||
|
|
@ -339,9 +338,9 @@ module.exports = {
|
|||
editor.copyLinesUp();
|
||||
assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
|
||||
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 3, 0);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 1, 0);
|
||||
assert.position(editor.getCursorPosition(), 2, 1);
|
||||
assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
|
||||
assert.position(editor.getSelection().getSelectionLead(), 2, 1);
|
||||
},
|
||||
|
||||
"test: input a tab with soft tab should convert it to spaces" : function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue