1- import type { Denops } from "jsr:@denops/std@^7.3.0" ;
21import { test } from "jsr:@denops/test@^3.0.4" ;
32import * as fn from "jsr:@denops/std@^7.3.0/function" ;
43import { assertEquals , assertNotEquals } from "jsr:@std/assert@^1.0.7" ;
@@ -8,15 +7,6 @@ import { DOUBLE_BORDER } from "../../@fall/builtin/theme/double.ts";
87import { screentext } from "./_testutil.ts" ;
98import { BaseComponent } from "./_component.ts" ;
109
11- class TestComponent extends BaseComponent {
12- render (
13- _denops : Denops ,
14- _option ?: { signal ?: AbortSignal } ,
15- ) : Promise < true | void > {
16- return Promise . resolve ( true ) ;
17- }
18- }
19-
2010const dimension = {
2111 col : 1 ,
2212 row : 1 ,
@@ -31,31 +21,30 @@ test(
3121 await t . step (
3222 "info is `undefined` if the component is not opened" ,
3323 async ( ) => {
34- await using component = new TestComponent ( { dimension } ) ;
24+ await using component = new BaseComponent ( ) ;
3525 assertEquals ( component . info , undefined ) ;
3626 } ,
3727 ) ;
3828
3929 await t . step ( "info is a value if the component is opened" , async ( ) => {
40- await using component = new TestComponent ( { dimension } ) ;
41- await component . open ( denops ) ;
30+ await using component = new BaseComponent ( ) ;
31+ await component . open ( denops , dimension ) ;
4232 assertNotEquals ( component . info , undefined ) ;
4333 } ) ;
4434 } ,
4535) ;
4636
4737test ( "nvim" , "Component" , async ( denops , t ) => {
4838 await t . step ( "open opens the component window" , async ( ) => {
49- await using component = new TestComponent ( {
50- dimension : {
51- col : 1 ,
52- row : 1 ,
53- width : 5 ,
54- height : 5 ,
55- } ,
39+ await using component = new BaseComponent ( {
5640 border : SINGLE_BORDER ,
5741 } ) ;
58- await component . open ( denops ) ;
42+ await component . open ( denops , {
43+ col : 1 ,
44+ row : 1 ,
45+ width : 5 ,
46+ height : 5 ,
47+ } ) ;
5948 await denops . cmd ( "redraw" ) ;
6049
6150 const info = component . info ! ;
@@ -92,33 +81,36 @@ test("nvim", "Component", async (denops, t) => {
9281 await t . step (
9382 "open does nothing if the component window is already opened" ,
9483 async ( ) => {
95- await using component = new TestComponent ( {
96- dimension : {
97- col : 1 ,
98- row : 1 ,
99- width : 5 ,
100- height : 5 ,
101- } ,
84+ await using component = new BaseComponent ( {
10285 border : SINGLE_BORDER ,
10386 } ) ;
104- await component . open ( denops ) ;
105- await component . open ( denops ) ;
87+ await component . open ( denops , {
88+ col : 1 ,
89+ row : 1 ,
90+ width : 5 ,
91+ height : 5 ,
92+ } ) ;
93+ await component . open ( denops , {
94+ col : 1 ,
95+ row : 1 ,
96+ width : 5 ,
97+ height : 5 ,
98+ } ) ;
10699 } ,
107100 ) ;
108101
109102 await t . step (
110103 "move moves the component window" ,
111104 async ( ) => {
112- await using component = new TestComponent ( {
113- dimension : {
114- col : 1 ,
115- row : 1 ,
116- width : 5 ,
117- height : 5 ,
118- } ,
105+ await using component = new BaseComponent ( {
119106 border : SINGLE_BORDER ,
120107 } ) ;
121- await component . open ( denops ) ;
108+ await component . open ( denops , {
109+ col : 1 ,
110+ row : 1 ,
111+ width : 5 ,
112+ height : 5 ,
113+ } ) ;
122114 await component . move ( denops , {
123115 col : 10 ,
124116 row : 10 ,
@@ -167,13 +159,7 @@ test("nvim", "Component", async (denops, t) => {
167159 await t . step (
168160 "move does nothing if the component window is not opened" ,
169161 async ( ) => {
170- await using component = new TestComponent ( {
171- dimension : {
172- col : 1 ,
173- row : 1 ,
174- width : 5 ,
175- height : 5 ,
176- } ,
162+ await using component = new BaseComponent ( {
177163 border : SINGLE_BORDER ,
178164 } ) ;
179165 await component . move ( denops , {
@@ -188,16 +174,15 @@ test("nvim", "Component", async (denops, t) => {
188174 await t . step (
189175 "update updates the component window" ,
190176 async ( ) => {
191- await using component = new TestComponent ( {
192- dimension : {
193- col : 1 ,
194- row : 1 ,
195- width : 5 ,
196- height : 5 ,
197- } ,
177+ await using component = new BaseComponent ( {
198178 border : SINGLE_BORDER ,
199179 } ) ;
200- await component . open ( denops ) ;
180+ await component . open ( denops , {
181+ col : 1 ,
182+ row : 1 ,
183+ width : 5 ,
184+ height : 5 ,
185+ } ) ;
201186 await component . update ( denops , {
202187 title : "Test" ,
203188 border : DOUBLE_BORDER ,
@@ -239,13 +224,7 @@ test("nvim", "Component", async (denops, t) => {
239224 await t . step (
240225 "update does nothing if the component window is not opened" ,
241226 async ( ) => {
242- await using component = new TestComponent ( {
243- dimension : {
244- col : 1 ,
245- row : 1 ,
246- width : 5 ,
247- height : 5 ,
248- } ,
227+ await using component = new BaseComponent ( {
249228 border : SINGLE_BORDER ,
250229 } ) ;
251230 await component . update ( denops , {
@@ -256,16 +235,15 @@ test("nvim", "Component", async (denops, t) => {
256235 ) ;
257236
258237 await t . step ( "close closes the component window" , async ( ) => {
259- await using component = new TestComponent ( {
260- dimension : {
261- col : 1 ,
262- row : 1 ,
263- width : 5 ,
264- height : 5 ,
265- } ,
238+ await using component = new BaseComponent ( {
266239 border : SINGLE_BORDER ,
267240 } ) ;
268- await component . open ( denops ) ;
241+ await component . open ( denops , {
242+ col : 1 ,
243+ row : 1 ,
244+ width : 5 ,
245+ height : 5 ,
246+ } ) ;
269247 await denops . cmd ( "redraw" ) ;
270248
271249 const info = component . info ! ;
0 commit comments