aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/menu_spec.lua
blob: 8f4a195fd7e377107e28ee959d151287aab0c07d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
local helpers = require('test.functional.helpers')
local Screen = require('test.functional.ui.screen').new(40,4)
local clear, execute, nvim = helpers.clear, helpers.execute, helpers.nvim
local expect = helpers.expect
local feed = helpers.feed
local command = helpers.command

describe(':emenu', function()

  before_each(function()
    clear()
    execute('nnoremenu Test.Test inormal<ESC>')
    execute('inoremenu Test.Test insert')
    execute('vnoremenu Test.Test x')
  end)

  it('executes correct bindings in normal mode without using API', function()
    execute('emenu Test.Test')
    expect('normal')
  end)

  it('executes correct bindings in normal mode', function()
    command('emenu Test.Test')
    expect('normal')
  end)

  it('executes correct bindings in insert mode', function()
    feed('i')
    command('emenu Test.Test')
    expect('insert')
  end)

  it('executes correct bindings in visual mode', function()
    feed('iabcde<ESC>0lvll')
    command('emenu Test.Test')
    expect('ae')
  end)

end)

describe('emenu Edit.Paste while in commandline', function()
    before_each(function()
      clear()
      screen = Screen.new(40, 4)
      screen:attach()
    end)

    it('ok', function()
        nvim('command', 'runtime menu.vim')
        feed('ithis is a sentence<esc>^"+yiwo<esc>')
        nvim('command', 'emenu Edit.Paste')
        feed(':')
        nvim('command', 'emenu Edit.Paste')
        screen:expect([[
          this is a sentence                      |
          this                                    |
          ~                                       |
          :this^                                   |
        ]])
    end)
end)