repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

test(cmdline): add test for border highlight update on format change

9f1a305e2ec38448322b9653a16fced3f4e20c5d

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Verifies that when show() is called twice with different format types
(cmdline then help), the window's winhighlight is updated to reflect
the new format's border highlight.

Changed files (1)

neovim/tests/bugabinga/cmdline/render_spec.lua

Modified
80 80 assert.is_true(ok)
83 + it('updates winhighlight when format changes between show calls', function()
84 + local state = require 'bugabinga.cmdline.state'
85 + local render = require 'bugabinga.cmdline.render'
86 + local cmdline_state1 = state.new({
87 + { {}, '' },
88 + }, 1, ':', '', 0, 1)
89 + render.show(cmdline_state1)
90 + local pos = require('bugabinga.cmdline.position')
91 + local anchor1 = pos.get_cmdline_anchor()
92 + local win1 = anchor1.win
93 + local wh1 = vim.wo[win1].winhighlight
94 + local cmdline_state2 = state.new({
95 + { {}, 'h' },
96 + }, 2, ':', '', 0, 1)
97 + render.show(cmdline_state2)
98 + local anchor2 = pos.get_cmdline_anchor()
99 + local win2 = anchor2.win
100 + local wh2 = vim.wo[win2].winhighlight
101 + assert.is_true(wh1 ~= wh2, 'winhighlight should differ between cmdline and help formats')
102 + render.hide()
103 + end)
84 106 describe('render.hide', function()