diff options
| author | Stephen Blott | 2016-03-25 11:38:18 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-25 11:38:18 +0000 |
| commit | 9bc02b6fe8329fc6342196070f68f1657075c3db (patch) | |
| tree | 3c8dbe325a592e27eb7f664d53682b9e927e8227 /tests | |
| parent | 69333f609bcdf3724ae639d7389750cfe18f4523 (diff) | |
| download | vimium-9bc02b6fe8329fc6342196070f68f1657075c3db.tar.bz2 | |
Better choice of callapse on exit.
The question here is where to callapse the selection to, anchor or
focus?
When exiting visual mode, mimic vim. When trasitioning between visual
and caret modes, do what's right to keep the selection in the same
place.
This also adds some related tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/dom_tests/dom_tests.coffee | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee index 517dce99..2311b768 100644 --- a/tests/dom_tests/dom_tests.coffee +++ b/tests/dom_tests/dom_tests.coffee @@ -744,12 +744,6 @@ context "Caret mode", By thy long grey beard and glittering eye, Now wherefore stopp'st thou me? </pre></p> - <p><pre> - The Bridegroom's doors are opened wide, - And I am next of kin; - The guests are met, the feast is set: - May'st hear the merry din. - </pre></p> """ initializeModeState() @initialVisualMode = new VisualMode @@ -793,6 +787,21 @@ context "Caret mode", sendKeyboardEvent "k" assert.equal "I", getSelection() + should "re-use an existing selection", -> + assert.equal "I", getSelection() + sendKeyboardEvents "ww" + assert.equal "a", getSelection() + sendKeyboardEvent "escape" + new VisualMode + assert.equal "a", getSelection() + + should "not move the selection on caret/visual mode toggle", -> + sendKeyboardEvents "ww" + assert.equal "a", getSelection() + for key in "vcvcvc".split() + sendKeyboardEvent key + assert.equal "a", getSelection() + context "Visual mode", setup -> document.getElementById("test-div").innerHTML = """ @@ -802,12 +811,6 @@ context "Visual mode", By thy long grey beard and glittering eye, Now wherefore stopp'st thou me? </pre></p> - <p><pre> - The Bridegroom's doors are opened wide, - And I am next of kin; - The guests are met, the feast is set: - May'st hear the merry din. - </pre></p> """ initializeModeState() @initialVisualMode = new VisualMode |
