@@ -2288,71 +2288,75 @@ T['Open'] = new_set({
22882288
22892289-- stylua: ignore
22902290T [' Open' ][' works' ] = function ()
2291+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1002 or 1003
22912292 child .cmd (' topleft vertical new' )
22922293 sleep (small_time )
22932294 validate_floats ({
2294- [1003 ] = {
2295+ [win_id ] = {
22952296 anchor = ' NW' , external = false , focusable = false , relative = ' editor' , zindex = 1 ,
22962297 row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 ,
22972298 },
22982299 })
2299- eq (child .lua_get ( ' vim.wo[1003]. winhighlight' ), ' Normal:MiniAnimateNormalFloat' )
2300+ eq (child .api . nvim_win_get_option ( win_id , ' winhighlight' ), ' Normal:MiniAnimateNormalFloat' )
23002301
23012302 sleep (step_time )
2302- validate_floats ({ [1003 ] = { row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 } })
2303+ validate_floats ({ [win_id ] = { row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 } })
23032304
23042305 sleep (step_time )
2305- validate_floats ({ [1003 ] = false })
2306+ validate_floats ({ [win_id ] = false })
23062307end
23072308
23082309T [' Open' ][' works for a new tabpage' ] = function ()
2310+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1002 or 1003
23092311 child .cmd (' tabedit' )
23102312 sleep (small_time )
23112313 validate_floats ({
2312- [1003 ] = { relative = ' editor' , row = 1 , col = 0 , width = 12 , height = 5 , winblend = 80 },
2314+ [win_id ] = { relative = ' editor' , row = 1 , col = 0 , width = 12 , height = 5 , winblend = 80 },
23132315 })
23142316 sleep (2 * 20 )
23152317 child .cmd (' tabclose' )
23162318
23172319 -- Should also work second time (testing correct usage of tabpage number)
23182320 child .cmd (' tabedit' )
23192321 validate_floats ({
2320- [1005 ] = { relative = ' editor' , row = 1 , col = 0 , width = 12 , height = 5 , winblend = 80 },
2322+ [win_id + 2 ] = { relative = ' editor' , row = 1 , col = 0 , width = 12 , height = 5 , winblend = 80 },
23212323 })
23222324end
23232325
23242326T [' Open' ][' allows only one active animation' ] = function ()
2327+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1002 or 1003
23252328 child .cmd (' topleft vertical new' )
23262329 sleep (small_time )
23272330 validate_floats ({
2328- [1003 ] = { relative = ' editor' , row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 },
2331+ [win_id ] = { relative = ' editor' , row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 },
23292332 })
23302333
23312334 child .cmd (' botright new' )
23322335 sleep (step_time + small_time )
23332336 -- stylua: ignore
23342337 validate_floats ({
2335- [1003 ] = false ,
2336- [1005 ] = {
2338+ [win_id ] = false ,
2339+ [win_id + 2 ] = {
23372340 -- It is already a second step with quarter coverage
23382341 relative = ' editor' , row = 3 , col = 0 , width = 6 , height = 2 , winblend = 90 ,
23392342 },
23402343 })
23412344end
23422345
23432346T [' Open' ][' reopens floating window if it was closed manually' ] = function ()
2347+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1002 or 1003
23442348 child .cmd (' topleft vertical new' )
23452349 sleep (small_time )
23462350 validate_floats ({
2347- [1003 ] = { relative = ' editor' , row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 },
2351+ [win_id ] = { relative = ' editor' , row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 },
23482352 })
23492353 child .cmd (' only' )
23502354 eq (child .api .nvim_list_wins (), { 1001 })
23512355
23522356 sleep (step_time )
23532357 validate_floats ({
23542358 -- It is already a second step with quarter coverage
2355- [1004 ] = { relative = ' editor' , row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 },
2359+ [win_id + 1 ] = { relative = ' editor' , row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 },
23562360 })
23572361end
23582362
@@ -2422,6 +2426,7 @@ T['Open']['respects `vim.{g,b}.minianimate_disable`'] = new_set({
24222426 parametrize = { { ' g' }, { ' b' } },
24232427}, {
24242428 test = function (var_type )
2429+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1003 or 1004
24252430 child [var_type ].minianimate_disable = true
24262431 child .cmd (' wincmd v' )
24272432 -- Should open without animation
@@ -2431,7 +2436,7 @@ T['Open']['respects `vim.{g,b}.minianimate_disable`'] = new_set({
24312436 child .cmd (' wincmd v' )
24322437 -- Should open with animation
24332438 sleep (small_time )
2434- validate_floats ({ [1004 ] = { relative = ' editor' } })
2439+ validate_floats ({ [win_id ] = { relative = ' editor' } })
24352440 end ,
24362441})
24372442
@@ -2471,22 +2476,23 @@ T['Close'] = new_set({
24712476
24722477-- stylua: ignore
24732478T [' Close' ][' works' ] = function ()
2479+ local win_id = child .fn .has (' nvim-0.10' ) == 1 and 1002 or 1003
24742480 child .cmd (' topleft vertical new' )
24752481 child .cmd (' close' )
24762482 sleep (small_time )
24772483 validate_floats ({
2478- [1003 ] = {
2484+ [win_id ] = {
24792485 anchor = ' NW' , external = false , focusable = false , relative = ' editor' , zindex = 1 ,
24802486 row = 0 , col = 0 , width = 6 , height = 6 , winblend = 80 ,
24812487 },
24822488 })
2483- eq (child .lua_get ( ' vim.wo[1003]. winhighlight' ), ' Normal:MiniAnimateNormalFloat' )
2489+ eq (child .api . nvim_win_get_option ( win_id , ' winhighlight' ), ' Normal:MiniAnimateNormalFloat' )
24842490
24852491 sleep (step_time )
2486- validate_floats ({ [1003 ] = { row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 } })
2492+ validate_floats ({ [win_id ] = { row = 0 , col = 0 , width = 3 , height = 3 , winblend = 90 } })
24872493
24882494 sleep (step_time )
2489- validate_floats ({ [1003 ] = false })
2495+ validate_floats ({ [win_id ] = false })
24902496end
24912497
24922498T [' Close' ][' respects `enable` config setting' ] = function ()
0 commit comments