robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local n =require ( 'test.functional.testnvim' )() 2local t =require ( 'test.testutil' ) 3local Screen =require ( 'test.functional.ui.screen' ) 4 5local describe , it , before_each =t . describe , t . it , t . before_each 6local clear =n . clear 7local command =n . command 8local feed =n . feed 9 10describe ( 'update_menu notification' , function () 11local screen 12 13before_each ( function () 14clear () 15screen =Screen . new () 16end ) 17 18local function expect_sent ( expected ) 19screen : expect { 20condition =function () 21if screen . update_menu ~= expected then 22if expected then 23error ( 'update_menu was expected but not sent' ) 24else 25error ( 'update_menu was sent unexpectedly' ) 26end 27end 28end , 29unchanged =not expected , 30} 31end 32 33it ( 'should be sent when adding a menu' , function () 34command ( 'menu Test.Test :' ) 35expect_sent ( true ) 36end ) 37 38it ( 'should be sent when deleting a menu' , function () 39command ( 'menu Test.Test :' ) 40screen . update_menu =false 41 42command ( 'unmenu Test.Test' ) 43expect_sent ( true ) 44end ) 45 46it ( 'should not be sent unnecessarily' , function () 47feed ( 'i12345<ESC>:redraw<CR>' ) 48expect_sent ( false ) 49end ) 50end )