@@ -4,7 +4,7 @@ import * as fn from "../function/mod.ts";
4
4
import * as vimFn from "../function/vim/mod.ts" ;
5
5
import * as nvimFn from "../function/nvim/mod.ts" ;
6
6
import * as buffer from "./buffer.ts" ;
7
- import { decorate , listDecorations } from "./decoration.ts" ;
7
+ import { decorate , listDecorations , undecorate } from "./decoration.ts" ;
8
8
9
9
test ( {
10
10
mode : "vim" ,
@@ -149,3 +149,70 @@ test({
149
149
] ) ;
150
150
} ,
151
151
} ) ;
152
+
153
+ test ( {
154
+ mode : "all" ,
155
+ name : "undecorate clears decorations in the buffer" ,
156
+ fn : async ( denops ) => {
157
+ const bufnr = await fn . bufnr ( denops ) ;
158
+ await buffer . replace ( denops , bufnr , [
159
+ "Hello" ,
160
+ "Darkness" ,
161
+ "My" ,
162
+ "Old friend" ,
163
+ ] ) ;
164
+ await decorate ( denops , bufnr , [
165
+ {
166
+ line : 1 ,
167
+ column : 1 ,
168
+ length : 5 ,
169
+ highlight : "Title" ,
170
+ } ,
171
+ {
172
+ line : 2 ,
173
+ column : 2 ,
174
+ length : 3 ,
175
+ highlight : "Search" ,
176
+ } ,
177
+ ] ) ;
178
+ await undecorate ( denops , bufnr ) ;
179
+ assertEquals ( await listDecorations ( denops , bufnr ) , [ ] ) ;
180
+ } ,
181
+ } ) ;
182
+
183
+ test ( {
184
+ mode : "all" ,
185
+ name : "undecorate clears decorations in specified region in the buffer" ,
186
+ fn : async ( denops ) => {
187
+ const bufnr = await fn . bufnr ( denops ) ;
188
+ await buffer . replace ( denops , bufnr , [
189
+ "Hello" ,
190
+ "Darkness" ,
191
+ "My" ,
192
+ "Old friend" ,
193
+ ] ) ;
194
+ await decorate ( denops , bufnr , [
195
+ {
196
+ line : 1 ,
197
+ column : 1 ,
198
+ length : 5 ,
199
+ highlight : "Title" ,
200
+ } ,
201
+ {
202
+ line : 2 ,
203
+ column : 2 ,
204
+ length : 3 ,
205
+ highlight : "Search" ,
206
+ } ,
207
+ ] ) ;
208
+ await undecorate ( denops , bufnr , 0 , 1 ) ;
209
+ assertEquals ( await listDecorations ( denops , bufnr ) , [
210
+ {
211
+ line : 2 ,
212
+ column : 2 ,
213
+ length : 3 ,
214
+ highlight : "Search" ,
215
+ } ,
216
+ ] ) ;
217
+ } ,
218
+ } ) ;
0 commit comments