summaryrefslogtreecommitdiff
path: root/test/test_highlight_placement.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-06 16:20:39 +0100
committerw0rp <devw0rp@gmail.com>2017-05-06 16:20:39 +0100
commitbf8aae02e8a1a58649c4617008bd38b71b6b602d (patch)
treecb2d2f3e25a5c2b7a74558d48ffc441474110199 /test/test_highlight_placement.vader
parent0ac82f0a1798e7a82f83e549f9b60fbdc24287a5 (diff)
downloadale-bf8aae02e8a1a58649c4617008bd38b71b6b602d.zip
Fix #534 - Stop other higlights being restored when buffers are hidden and shown again
Diffstat (limited to 'test/test_highlight_placement.vader')
-rw-r--r--test/test_highlight_placement.vader22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader
index 14c16328..e67bca01 100644
--- a/test/test_highlight_placement.vader
+++ b/test/test_highlight_placement.vader
@@ -28,12 +28,14 @@ Before:
\ 'command': 'echo',
\ 'callback': 'GenerateResults',
\})
+ highlight link SomeOtherGroup SpellBad
After:
delfunction GenerateResults
call ale#linter#Reset()
let g:ale_buffer_info = {}
call clearmatches()
+ highlight clear SomeOtherGroup
Given testft(A Javscript file with warnings/errors):
foo
@@ -107,3 +109,23 @@ Execute(Highlights should be cleared when buffers are hidden):
call ale#highlight#UpdateHighlights()
AssertEqual 1, len(getmatches()), 'The highlights weren''t set again!'
+
+Execute(Only ALE highlights should be restored when buffers are restored):
+ call ale#engine#InitBufferInfo(bufnr('%'))
+ call ale#highlight#SetHighlights(bufnr('%'), [
+ \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2},
+ \])
+
+ call matchaddpos('SomeOtherGroup', [[1, 1, 1]])
+
+ " We should have one more match here.
+ AssertEqual 2, len(getmatches()), 'The highlights weren''t initially set!'
+
+ call ale#highlight#BufferHidden(bufnr('%'))
+
+ AssertEqual 0, len(getmatches()), 'The highlights weren''t cleared!'
+
+ call ale#highlight#UpdateHighlights()
+
+ " Only our matches should appear again.
+ AssertEqual 1, len(getmatches()), 'The highlights weren''t set again!'