blob: 0ef72f4b77a5093dc32512bc7bb01f5644e0283c (
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
|
local n = require('test.functional.testnvim')()
local t = require('test.testutil')
local Screen = require('test.functional.ui.screen')
local describe, it, before_each = t.describe, t.it, t.before_each
local clear = n.clear
local command = n.command
local feed = n.feed
describe('update_menu notification', function()
local screen
before_each(function()
clear()
screen = Screen.new()
end)
local function expect_sent(expected)
screen:expect {
condition = function()
if screen.update_menu ~= expected then
if expected then
error('update_menu was expected but not sent')
else
error('update_menu was sent unexpectedly')
end
end
end,
unchanged = not expected,
}
end
it('should be sent when adding a menu', function()
command('menu Test.Test :')
expect_sent(true)
end)
it('should be sent when deleting a menu', function()
command('menu Test.Test :')
screen.update_menu = false
command('unmenu Test.Test')
expect_sent(true)
end)
it('should not be sent unnecessarily', function()
feed('i12345<ESC>:redraw<CR>')
expect_sent(false)
end)
end)
|