From a3c03e442a28c55ec2e9c61017541fc2d6433707 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sun, 21 Apr 2024 07:48:03 -0700 Subject: [PATCH] test: add regression test for #355 --- tests/regression_spec.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/regression_spec.lua b/tests/regression_spec.lua index 20da321e..8eff2b0e 100644 --- a/tests/regression_spec.lua +++ b/tests/regression_spec.lua @@ -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") @@ -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)