aboutsummaryrefslogtreecommitdiff
path: root/test/functional/editor/defaults_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/editor/defaults_spec.lua
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/editor/defaults_spec.lua')
-rw-r--r--test/functional/editor/defaults_spec.lua157
1 files changed, 153 insertions, 4 deletions
diff --git a/test/functional/editor/defaults_spec.lua b/test/functional/editor/defaults_spec.lua
index 47fd177f7b..82d285cc9a 100644
--- a/test/functional/editor/defaults_spec.lua
+++ b/test/functional/editor/defaults_spec.lua
@@ -35,7 +35,6 @@ describe('default', function()
args = { '+autocmd! nvim_popupmenu', '+aunmenu PopUp' },
}
local screen = Screen.new(40, 8)
- screen:attach()
n.insert([[
1 line 1
2 https://example.com
@@ -58,7 +57,6 @@ describe('default', function()
it('right-click on URL shows "Open in web browser"', function()
n.clear()
local screen = Screen.new(40, 8)
- screen:attach()
n.insert([[
1 line 1
2 https://example.com
@@ -95,6 +93,157 @@ describe('default', function()
end)
end)
- -- describe('key mappings', function()
- -- end)
+ describe('key mappings', function()
+ describe('unimpaired-style mappings', function()
+ it('do not show a full stack trace #30625', function()
+ n.clear({ args_rm = { '--cmd' } })
+ local screen = Screen.new(40, 8)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.NvimDarkGray4 },
+ [2] = {
+ background = Screen.colors.NvimLightGrey3,
+ foreground = Screen.colors.NvimDarkGray3,
+ },
+ [3] = { foreground = Screen.colors.NvimLightRed },
+ [4] = { foreground = Screen.colors.NvimLightCyan },
+ })
+
+ n.feed('[a')
+ screen:expect({
+ grid = [[
+ |
+ {1:~ }|*4
+ {2: }|
+ {3:E163: There is only one file to edit} |
+ {4:Press ENTER or type command to continue}^ |
+ ]],
+ })
+
+ n.feed('[q')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*5
+ {2:[No Name] 0,0-1 All}|
+ {3:E42: No Errors} |
+ ]],
+ })
+
+ n.feed('[l')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*5
+ {2:[No Name] 0,0-1 All}|
+ {3:E776: No location list} |
+ ]],
+ })
+
+ n.feed('[t')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*5
+ {2:[No Name] 0,0-1 All}|
+ {3:E73: Tag stack empty} |
+ ]],
+ })
+ end)
+
+ describe('[<Space>', function()
+ it('adds an empty line above the current line', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed('[<Space>')
+ n.expect([[
+
+ first line]])
+ end)
+
+ it('works with a count', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed('5[<Space>')
+ n.expect([[
+
+
+
+
+
+ first line]])
+ end)
+
+ it('supports dot repetition', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed('[<Space>')
+ n.feed('.')
+ n.expect([[
+
+
+ first line]])
+ end)
+
+ it('supports dot repetition and a count', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed('[<Space>')
+ n.feed('3.')
+ n.expect([[
+
+
+
+
+ first line]])
+ end)
+ end)
+
+ describe(']<Space>', function()
+ it('adds an empty line below the current line', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed(']<Space>')
+ n.expect([[
+ first line
+ ]])
+ end)
+
+ it('works with a count', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed('5]<Space>')
+ n.expect([[
+ first line
+
+
+
+
+ ]])
+ end)
+
+ it('supports dot repetition', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed(']<Space>')
+ n.feed('.')
+ n.expect([[
+ first line
+
+ ]])
+ end)
+
+ it('supports dot repetition and a count', function()
+ n.clear({ args_rm = { '--cmd' } })
+ n.insert([[first line]])
+ n.feed(']<Space>')
+ n.feed('2.')
+ n.expect([[
+ first line
+
+
+ ]])
+ end)
+ end)
+ end)
+ end)
end)