Skip to content

Commit

Permalink
Added tests to check gj/gk preserves cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
hetmankp committed Sep 26, 2019
1 parent 10c4ca8 commit 3cd22f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/mode/modeVisual.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@ suite('Mode Visual', () => {
keysPressed: 'vgjx',
end: ['blah', 'duh', '|ur'],
});

newTest({
title: "Preserves cursor position when handling 'gk'",
start: ['blah', 'duh', 'a', 'hu|r '],
keysPressed: 'vgkgky',
end: ['blah', 'du|h', 'a', 'hur '],
});

newTest({
title: "Preserves cursor position when handling 'gj'",
start: ['blah', 'du|h', 'a', 'hur '],
keysPressed: 'vgjgjy',
end: ['blah', 'duh', 'a', 'hu|r '],
});
});

suite('handles aw in visual mode', () => {
Expand Down
14 changes: 14 additions & 0 deletions test/mode/normalModeTests/motions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,4 +739,18 @@ suite('Motions in Normal Mode', () => {
keysPressed: 'gj',
end: ['blah', 'duh', 'dur', '|hur'],
});

newTest({
title: "Preserves cursor position when handling 'gk'",
start: ['blah', 'duh', 'a', 'hu|r '],
keysPressed: 'gkgk',
end: ['blah', 'du|h', 'a', 'hur '],
});

newTest({
title: "Preserves cursor position when handling 'gj'",
start: ['blah', 'du|h', 'a', 'hur '],
keysPressed: 'gjgj',
end: ['blah', 'duh', 'a', 'hu|r '],
});
});

0 comments on commit 3cd22f7

Please sign in to comment.