diff options
Diffstat (limited to 'lua/99/test')
| -rw-r--r-- | lua/99/test/window_spec.lua | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/lua/99/test/window_spec.lua b/lua/99/test/window_spec.lua index c91c219..3f5c3c8 100644 --- a/lua/99/test/window_spec.lua +++ b/lua/99/test/window_spec.lua @@ -29,10 +29,47 @@ describe("Window", function() }) eq(2, #Window.active_windows) - eq(2, vim.wo[win.win_id].scrolloff) + eq(1, vim.wo[win.win_id].scrolloff) local legend = Window.active_windows[2] local lines = vim.api.nvim_buf_get_lines(legend.buf_id, 0, -1, false) - eq({ "<CR>=submit", "q=cancel" }, lines) + eq({ " <CR>=submit q=cancel" }, lines) + end) + + it("highlights keymap legend as warning=comment", function() + Window.capture_input("Prompt", { + cb = function() end, + keymap = { + q = "cancel", + ["<CR>"] = "submit", + }, + }) + + local legend = Window.active_windows[2] + local legend_nsid = vim.api.nvim_get_namespaces()["99.window.legend"] + local extmarks = vim.api.nvim_buf_get_extmarks( + legend.buf_id, + legend_nsid, + 0, + -1, + { details = true } + ) + + local highlights = {} + for _, extmark in ipairs(extmarks) do + table.insert(highlights, { + extmark[2], + extmark[3], + extmark[4].end_col, + extmark[4].hl_group, + }) + end + + eq({ + { 0, 1, 5, "WarningMsg" }, + { 0, 6, 12, "Comment" }, + { 0, 13, 14, "WarningMsg" }, + { 0, 15, 21, "Comment" }, + }, highlights) end) end) |
