mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-14 01:50:27 +00:00
test: add nvim_feedkeys test
This commit is contained in:
parent
11b6751d54
commit
e9db6eeb6e
@ -5,12 +5,14 @@ local harpoon = require("harpoon")
|
|||||||
local eq = assert.are.same
|
local eq = assert.are.same
|
||||||
local be = utils.before_each(os.tmpname())
|
local be = utils.before_each(os.tmpname())
|
||||||
|
|
||||||
--[[
|
---@param k string
|
||||||
local function key(k)
|
local function key(k)
|
||||||
k = vim.api.nvim_replace_termcodes(k, true, false, true)
|
vim.api.nvim_feedkeys(
|
||||||
vim.api.nvim_feedkeys(k, "m", false)
|
vim.api.nvim_replace_termcodes(k, true, false, true),
|
||||||
|
"x",
|
||||||
|
true
|
||||||
|
)
|
||||||
end
|
end
|
||||||
--]]
|
|
||||||
|
|
||||||
describe("harpoon", function()
|
describe("harpoon", function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
@ -113,4 +115,22 @@ describe("harpoon", function()
|
|||||||
eq(list:display(), created_files)
|
eq(list:display(), created_files)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
it("exiting the ui with something like <C-w><C-w>", function()
|
||||||
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
|
|
||||||
|
local bufnr = harpoon.ui.bufnr
|
||||||
|
local win_id = harpoon.ui.win_id
|
||||||
|
|
||||||
|
eq(vim.api.nvim_buf_is_valid(bufnr), true)
|
||||||
|
eq(vim.api.nvim_win_is_valid(win_id), true)
|
||||||
|
eq(vim.api.nvim_get_current_buf(), bufnr)
|
||||||
|
|
||||||
|
key("<C-w><C-w>")
|
||||||
|
|
||||||
|
eq(vim.api.nvim_buf_is_valid(bufnr), false)
|
||||||
|
eq(vim.api.nvim_win_is_valid(win_id), false)
|
||||||
|
eq(harpoon.ui.bufnr, nil)
|
||||||
|
eq(harpoon.ui.win_id, nil)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user