Skip to content

Commit 2d34583

Browse files
committed
test: setting the winborder option
1 parent 00dd0a9 commit 2d34583

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

spec/yazi/yazi_config_spec.lua

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
local assert = require("luassert")
2+
local reset = require("spec.yazi.helpers.reset")
3+
4+
local winborder_available = pcall(function()
5+
-- it's only available for nightly 0.11+, see
6+
-- https://github.com/neovim/neovim/pull/31074
7+
--
8+
-- will fail on stable neovim right now, so use pcall to avoid an error
9+
return vim.o.winborder
10+
end)
11+
12+
local function if_winborder_supported(fn)
13+
-- prevent tests failing on stable
14+
if winborder_available then
15+
fn()
16+
else
17+
print("`vim.o.winborder` is not supported, skipping")
18+
end
19+
end
20+
21+
describe("the default config", function()
22+
before_each(function()
23+
reset.clear_all_buffers()
24+
reset.close_all_windows()
25+
if_winborder_supported(function()
26+
vim.o.winborder = "solid"
27+
end)
28+
end)
29+
30+
describe("`yazi_floating_window_border`", function()
31+
it("sets it to the default value if not set", function()
32+
if_winborder_supported(function()
33+
vim.o.winborder = ""
34+
local config = require("yazi.config").default()
35+
assert.same("rounded", config.yazi_floating_window_border)
36+
end)
37+
end)
38+
39+
it("allows customizing it with the `vim.o.winborder` option", function()
40+
if_winborder_supported(function()
41+
vim.o.winborder = "single"
42+
local config = require("yazi.config").default()
43+
assert.same("single", config.yazi_floating_window_border)
44+
end)
45+
end)
46+
47+
it("yazi.setup() allows customizing it", function()
48+
if_winborder_supported(function()
49+
vim.o.winborder = "double"
50+
require("yazi").setup({ yazi_floating_window_border = "single" })
51+
assert.same(
52+
"single",
53+
require("yazi").config.yazi_floating_window_border
54+
)
55+
end)
56+
end)
57+
end)
58+
end)

0 commit comments

Comments
 (0)