Skip to content

Commit

Permalink
test: add regression test for #355
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Apr 21, 2024
1 parent 2bc56ad commit a3c03e4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/regression_spec.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require("plenary.async").tests.add_to_env()
local TmpDir = require("tests.tmpdir")
local actions = require("oil.actions")
local oil = require("oil")
local test_util = require("tests.test_util")
local view = require("oil.view")
Expand Down Expand Up @@ -131,4 +132,18 @@ a.describe("regression tests", function()
["baz.txt"] = "",
})
end)

-- https://github.com/stevearc/oil.nvim/issues/355
a.it("can open files from floating window", function()
tmpdir:create({ "a.txt" })
a.util.scheduler()
oil.open_float(tmpdir.path)
test_util.wait_for_autocmd({ "User", pattern = "OilEnter" })
local oil_bufnr = vim.api.nvim_get_current_buf()
actions.select.callback()
vim.wait(1000, function()
return vim.fn.expand("%:t") == "a.txt"
end, 10)
assert.equals("a.txt", vim.fn.expand("%:t"))
end)
end)

0 comments on commit a3c03e4

Please sign in to comment.