Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a1e77c2

Browse files
committedMar 14, 2019
Add test for hover window using floating window
1 parent 572f84a commit a1e77c2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
 

Diff for: ‎tests/LanguageClient_test.py

+29
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,32 @@ def test_languageClient_registerHandlers(nvim):
208208
# if b.name.startswith('term://')), None) is None)
209209

210210
# assertRetry(lambda: len(nvim.funcs.getqflist()) == 0)
211+
212+
def test_textDocument_hover_float_window(nvim):
213+
if not nvim.funcs.exists('*nvim_open_win'):
214+
pytest.skip('Neovim 0.3.0 or earlier does not support floating window')
215+
216+
nvim.command("edit! {}".format(PATH_INDEXJS))
217+
time.sleep(1)
218+
219+
buf = nvim.current.buffer
220+
221+
nvim.funcs.cursor(13, 19)
222+
pos = nvim.funcs.getpos('.')
223+
nvim.funcs.LanguageClient_textDocument_hover()
224+
time.sleep(1)
225+
float_buf = next(b for b in nvim.buffers if b.name.endswith('__LanguageClient__'))
226+
227+
# Check if float window is open
228+
float_winnr = nvim.funcs.bufwinnr(float_buf.number)
229+
assert float_winnr > 0
230+
231+
# Check if cursor is not moved
232+
assert buf.number == nvim.current.buffer.number
233+
assert pos == nvim.funcs.getpos('.')
234+
235+
# Move cursor to left
236+
nvim.funcs.cursor(13, 17)
237+
238+
# Check float window buffer was closed by CursorMoved
239+
assert all(b for b in nvim.buffers if not b.name.endswith('__LanguageClient__'))

0 commit comments

Comments
 (0)
Please sign in to comment.