diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-27 23:40:39 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 05:49:47 +0800 |
commit | fbaa2787736173e417a93b958a9ca61e888e567d (patch) | |
tree | b35406f0f56f22c1903294c75ca85c7ad63fdb0c /test/functional/ui/float_spec.lua | |
parent | f65043154e023263bc98057b1792893ef2bfee18 (diff) | |
download | rneovim-fbaa2787736173e417a93b958a9ca61e888e567d.tar.gz rneovim-fbaa2787736173e417a93b958a9ca61e888e567d.tar.bz2 rneovim-fbaa2787736173e417a93b958a9ca61e888e567d.zip |
fix(pum): make :popup position correctly with float border
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 123 |
1 files changed, 120 insertions, 3 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index e2fe0a2df5..28c16642f1 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -9,6 +9,7 @@ local eval = helpers.eval local eq = helpers.eq local neq = helpers.neq local expect = helpers.expect +local exec = helpers.exec local exec_lua = helpers.exec_lua local insert = helpers.insert local meths = helpers.meths @@ -2123,7 +2124,7 @@ describe('float window', function() {5:║}{1:^ }{5:║}| {5:╚═════════╝}| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 5, true } + [5] = { { id = 1002 }, "NW", 1, 0, 5, true }; }, win_viewport={ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 0, linecount = 3, sum_scroll_delta = 0}; @@ -2181,8 +2182,8 @@ describe('float window', function() {1: abb }| {13: acc }| ]], float_pos={ - [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }, - [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 } + [5] = { { id = 1002 }, "NW", 1, 0, 5, true, 50 }; + [6] = { { id = -1 }, "NW", 5, 4, 0, false, 100 }; }, win_viewport={ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount=1, sum_scroll_delta = 0}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 3, linecount=3, sum_scroll_delta = 0}; @@ -2201,6 +2202,122 @@ describe('float window', function() {3:-- }{8:match 1 of 4} | ]]} end + + feed '<esc>' + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 5 + {5:╔═════════╗}| + {5:║}{1:aaa aab }{5:║}| + {5:║}{1:abb acc }{5:║}| + {5:║}{1:ac^c }{5:║}| + {5:╚═════════╝}| + ]], float_pos={ + [5] = { { id = 1002 }, "NW", 1, 0, 5, true }; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + {5:╔═════════╗} | + {0:~ }{5:║}{1:aaa aab }{5:║}{0: }| + {0:~ }{5:║}{1:abb acc }{5:║}{0: }| + {0:~ }{5:║}{1:ac^c }{5:║}{0: }| + {0:~ }{5:╚═════════╝}{0: }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]} + end + + exec([[ + nnoremenu Test.foo : + nnoremenu Test.bar : + nnoremenu Test.baz : + ]]) + feed ':popup Test<CR>' + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + :popup Test | + ## grid 5 + {5:╔═════════╗}| + {5:║}{1:aaa aab }{5:║}| + {5:║}{1:abb acc }{5:║}| + {5:║}{1:ac^c }{5:║}| + {5:╚═════════╝}| + ## grid 6 + {1: foo }| + {1: bar }| + {1: baz }| + ]], float_pos={ + [5] = { { id = 1002 }, "NW", 1, 0, 5, true }; + [6] = { { id = -1 }, "NW", 5, 4, 2, false, 250 }; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 2, curcol = 2, linecount = 3, sum_scroll_delta = 0}; + }} + else + screen:expect{grid=[[ + {5:╔═════════╗} | + {0:~ }{5:║}{1:aaa aab }{5:║}{0: }| + {0:~ }{5:║}{1:abb acc }{5:║}{0: }| + {0:~ }{5:║}{1:ac^c }{5:║}{0: }| + {0:~ }{5:╚═}{1: foo }{5:═══╝}{0: }| + {0:~ }{1: bar }{0: }| + {0:~ }{1: baz }{0: }| + {0:~ }| + {0:~ }| + :popup Test | + ]]} + end end) it('show ruler of current floating window', function() |