@@ -2,15 +2,14 @@ local prepare_buffer = require("tests.nvim-paredit.utils").prepare_buffer
2
2
local feedkeys = require (" tests.nvim-paredit.utils" ).feedkeys
3
3
local expect = require (" tests.nvim-paredit.utils" ).expect
4
4
local keybindings = require (" nvim-paredit.utils.keybindings" )
5
- local motions = require (" nvim-paredit.api.motions" )
6
5
7
- local next_element = keybindings .visualize (motions .move_to_next_element )
8
- local prev_element = keybindings .visualize (motions .move_to_prev_element )
6
+ local defaults = require (" nvim-paredit.defaults" )
9
7
10
8
describe (" motions with operator pending" , function ()
11
9
before_each (function ()
12
- vim .keymap .set (" o" , " E" , next_element , { buffer = true })
13
- vim .keymap .set (" o" , " B" , prev_element , { buffer = true })
10
+ keybindings .setup_keybindings ({
11
+ keys = defaults .default_keys
12
+ })
14
13
end )
15
14
16
15
it (" should delete next form" , function ()
@@ -87,8 +86,36 @@ describe("motions with operator pending", function()
87
86
cursor = { 1 , 4 },
88
87
})
89
88
end )
90
- after_each (function ()
91
- vim .keymap .del (" o" , " E" )
92
- vim .keymap .del (" o" , " B" )
89
+ end )
90
+
91
+ describe (" motions with operator pending and v:count" , function ()
92
+ before_each (function ()
93
+ keybindings .setup_keybindings ({
94
+ keys = defaults .default_keys
95
+ })
96
+ end )
97
+
98
+ it (" should delete the next 2 elements" , function ()
99
+ prepare_buffer ({
100
+ content = " (aa bb cc)" ,
101
+ cursor = { 1 , 4 },
102
+ })
103
+ feedkeys (" d2<S-e>" )
104
+ expect ({
105
+ content = " (aa )" ,
106
+ cursor = { 1 , 4 },
107
+ })
108
+ end )
109
+
110
+ it (" should delete the previous 2 elements" , function ()
111
+ prepare_buffer ({
112
+ content = " (aa bb cc)" ,
113
+ cursor = { 1 , 8 },
114
+ })
115
+ feedkeys (" d2<S-b>" )
116
+ expect ({
117
+ content = " (aa )" ,
118
+ cursor = { 1 , 4 },
119
+ })
93
120
end )
94
121
end )
0 commit comments