diff options
| author | Stephen Blott | 2016-03-25 10:14:39 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-25 10:14:41 +0000 |
| commit | 326d6c486db97764123fdbeb68212624b9941da2 (patch) | |
| tree | f7df2da8bb8f225508afd034fcc5c7262364eb33 /content_scripts | |
| parent | a6fc63636c4e815ae128a8a15e7cf13ea028b297 (diff) | |
| download | vimium-326d6c486db97764123fdbeb68212624b9941da2.tar.bz2 | |
Add tests for visual mode.
The coverage here is far from completem but we do catch the basics.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/mode_visual.coffee | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/content_scripts/mode_visual.coffee b/content_scripts/mode_visual.coffee index c2d1037b..cacf8aa3 100644 --- a/content_scripts/mode_visual.coffee +++ b/content_scripts/mode_visual.coffee @@ -250,6 +250,10 @@ class VisualMode extends KeyHandlerMode unless @name == "caret" if @selection.type in [ "Caret", "Range" ] selectionRect = @selection.getRangeAt(0).getBoundingClientRect() + # Only for the tests. We don't have getBoundingClientRect() in the tests, so we patch in a default + # rect here. + # TODO(smblott) Is there a way to stub this properly? + selectionRect ||= {top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0} selectionRect = Rect.intersect selectionRect, Rect.create 0, 0, window.innerWidth, window.innerHeight if selectionRect.height >= 0 and selectionRect.width >= 0 # The selection is visible in the current viewport. |
