diff options
Diffstat (limited to 'test/functional/editor/defaults_spec.lua')
| -rw-r--r-- | test/functional/editor/defaults_spec.lua | 157 |
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) |