Skip to content

Commit db88b8e

Browse files
committed
Add test for hover window using floating window
1 parent 572f84a commit db88b8e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/LanguageClient_test.py

+32
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,35 @@ 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+
213+
def test_textDocument_hover_float_window(nvim):
214+
if not nvim.funcs.exists('*nvim_open_win'):
215+
pytest.skip('Neovim 0.3.0 or earlier does not support floating window')
216+
217+
nvim.command("edit! {}".format(PATH_INDEXJS))
218+
time.sleep(1)
219+
220+
buf = nvim.current.buffer
221+
222+
nvim.funcs.cursor(13, 19)
223+
pos = nvim.funcs.getpos('.')
224+
nvim.funcs.LanguageClient_textDocument_hover()
225+
time.sleep(1)
226+
float_buf = next(
227+
b for b in nvim.buffers if b.name.endswith('__LanguageClient__'))
228+
229+
# Check if float window is open
230+
float_winnr = nvim.funcs.bufwinnr(float_buf.number)
231+
assert float_winnr > 0
232+
233+
# Check if cursor is not moved
234+
assert buf.number == nvim.current.buffer.number
235+
assert pos == nvim.funcs.getpos('.')
236+
237+
# Move cursor to left
238+
nvim.funcs.cursor(13, 17)
239+
240+
# Check float window buffer was closed by CursorMoved
241+
assert all(
242+
b for b in nvim.buffers if not b.name.endswith('__LanguageClient__'))

0 commit comments

Comments
 (0)