aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_menu.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:31:31 +0000
commit9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch)
tree607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /src/nvim/testdir/test_menu.vim
parent9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff)
parent3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff)
downloadrneovim-usermarks.tar.gz
rneovim-usermarks.tar.bz2
rneovim-usermarks.zip
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'src/nvim/testdir/test_menu.vim')
-rw-r--r--src/nvim/testdir/test_menu.vim34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_menu.vim b/src/nvim/testdir/test_menu.vim
index 75992d3313..a1121632e6 100644
--- a/src/nvim/testdir/test_menu.vim
+++ b/src/nvim/testdir/test_menu.vim
@@ -153,7 +153,7 @@ func Test_menu_errors()
call assert_fails('menu Test.Foo.Bar', 'E327:')
call assert_fails('cmenu Test.Foo', 'E328:')
call assert_fails('emenu x Test.Foo', 'E475:')
- call assert_fails('emenu Test.Foo.Bar', 'E334:')
+ call assert_fails('emenu Test.Foo.Bar', 'E327:')
call assert_fails('menutranslate Test', 'E474:')
silent! unmenu Foo
@@ -252,6 +252,7 @@ func Test_menu_info()
nmenu Test.abc <Nop>
call assert_equal('<Nop>', menu_info('Test.abc').rhs)
call assert_fails('call menu_info([])', 'E730:')
+ call assert_fails('call menu_info("", [])', 'E730:')
nunmenu Test
" Test for defining menus in different modes
@@ -429,7 +430,7 @@ func Test_menu_special()
nunmenu Test.Sign
endfunc
-" Test for "icon=filname" in a toolbar
+" Test for "icon=filename" in a toolbar
func Test_menu_icon()
CheckFeature toolbar
nmenu icon=myicon.xpm Toolbar.Foo :echo "Foo"<CR>
@@ -481,6 +482,35 @@ func Test_popup_menu()
unmenu PopUp
endfunc
+" Test for MenuPopup autocommand
+func Test_autocmd_MenuPopup()
+ CheckNotGui
+
+ set mouse=a
+ set mousemodel=popup
+ aunmenu *
+ autocmd MenuPopup * exe printf(
+ \ 'anoremenu PopUp.Foo <Cmd>let g:res = ["%s", "%s"]<CR>',
+ \ expand('<afile>'), expand('<amatch>'))
+
+ call feedkeys("\<RightMouse>\<Down>\<CR>", 'tnix')
+ call assert_equal(['n', 'n'], g:res)
+
+ call feedkeys("v\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['v', 'v'], g:res)
+
+ call feedkeys("gh\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['s', 's'], g:res)
+
+ call feedkeys("i\<RightMouse>\<Down>\<CR>\<Esc>", 'tnix')
+ call assert_equal(['i', 'i'], g:res)
+
+ autocmd! MenuPopup
+ aunmenu PopUp.Foo
+ unlet g:res
+ set mouse& mousemodel&
+endfunc
+
" Test for listing the menus using the :menu command
func Test_show_menus()
" In the GUI, tear-off menu items are present in the output below