@@ -3,10 +3,54 @@ local function feedkeys(keys)
33end
44
55describe (" Bullets.vim" , function ()
6+ before_each (function ()
7+ require (" bullets" ).setup ({
8+ enabled_file_types = { " text" },
9+ enable_in_empty_buffers = false ,
10+ set_mappings = true ,
11+ mapping_leader = " " ,
12+ custom_mappings = {},
13+ })
14+ end )
15+
616 it (" loads the plugin" , function ()
717 assert .equals (2 , vim .fn .exists (" :InsertNewBullet" ))
818 end )
919
20+ it (" preserves native normal-mode o behavior" , function ()
21+ vim .cmd (" enew" )
22+ vim .bo .filetype = " text"
23+ vim .api .nvim_buf_set_lines (0 , 0 , - 1 , false , { " plain" })
24+ vim .api .nvim_win_set_cursor (0 , { 1 , 0 })
25+
26+ feedkeys (" ohello<Esc>" )
27+
28+ assert .are .same ({ " plain" , " hello" }, vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false ))
29+ end )
30+
31+ it (" preserves native insert-mode return fallback" , function ()
32+ vim .cmd (" enew" )
33+ vim .bo .filetype = " text"
34+ vim .api .nvim_buf_set_lines (0 , 0 , - 1 , false , { " plain" })
35+ vim .api .nvim_win_set_cursor (0 , { 1 , # " plain" })
36+
37+ feedkeys (" A<CR>next<Esc>" )
38+
39+ assert .are .same ({ " plain" , " next" }, vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false ))
40+ end )
41+
42+ it (" does not install default mappings when disabled" , function ()
43+ require (" bullets" ).setup ({
44+ enabled_file_types = { " text" },
45+ set_mappings = false ,
46+ })
47+ vim .cmd (" enew" )
48+ vim .bo .filetype = " text"
49+
50+ assert .equals (" " , vim .fn .maparg (" o" , " n" ))
51+ assert .equals (" " , vim .fn .maparg (" >>" , " n" ))
52+ end )
53+
1054 pending (" inserts a new bullet on <CR>" , function ()
1155 vim .cmd (" enew" )
1256 vim .bo .filetype = " text"
0 commit comments