Repository: neovim/neovim
File: test/functional/ui/float_spec.lua (Lua)

Code before:
        else
          api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
          screen:expect([[
            ^x                                       |
            a                                       |
            {0:~    }{1:y                   }{0:               }|
            {0:~    }{2:~                   }{0:               }|
            {0:~                                       }|*2
                                                    |
          ]])
        end
      end

      it('focus by mouse (focusable=false)', function()
        api.nvim_win_set_config(win, { focusable = false })
        test_float_mouse_no_focus()
      end)

      it('focus by mouse (focusable=true, mouse=false)', function()
        api.nvim_win_set_config(win, { mouse = false })
        test_float_mouse_no_focus()
      end)

      it(':help (focusable=false, hide=true)', function()
        command('help')
        local unfocusable_win = api.nvim_open_win(0, false, { focusable = false, relative = 'editor', width = 1, height = 1, row = 0, col = 0 })
        local hide_win = api.nvim_open_win(0, false, { hide = true, relative = 'editor', width = 1, height = 1, row = 0, col = 0 })
        command('helpclose')
        command('help')
        local cwin = curwin()
        neq(unfocusable_win, cwin)
        neq(hide_win, cwin)
      end)

      it('j', function()
        feed('<c-w>ji') -- INSERT to trigger screen change
        if multigrid then
          screen:expect {
            grid = [[
          ## grid 1
            [2:----------------------------------------]|*6
            [3:----------------------------------------]|
          ## grid 2
            ^x                                       |
            {0:~                                       }|*5
          ## grid 3
            {3:-- INSERT --}                            |
          ## grid 4
            {1:y                   }|
            {2:~                   }|
          ]],

Review comment (suggestion):
You need to use `n.add_builddir_to_rtp()` before `:help`

Code after:
            [3:----------------------------------------]|
          ## grid 2
            ^x                                       |
            a                                       |
            {0:~                                       }|*4
          ## grid 3
                                                    |
          ## grid 4
            {1:y                   }|
            {2:~                   }|
          ]],
            float_pos = expected_pos,
            unchanged = true,
          }
        else
          api.nvim_input_mouse('left', 'press', '', 0, 0, 0)
          screen:expect([[
            ^x                                       |
            a                                       |
            {0:~    }{1:y                   }{0:               }|
            {0:~    }{2:~                   }{0:               }|
            {0:~                                       }|*2
                                                    |
          ]])
        end
      end

      it('focus by mouse (focusable=false)', function()
        api.nvim_win_set_config(win, { focusable = false })
        test_float_mouse_no_focus()
      end)

      it('focus by mouse (focusable=true, mouse=false)', function()
        api.nvim_win_set_config(win, { mouse = false })
        test_float_mouse_no_focus()
      end)

      it(':help (focusable=false, hide=true)', function()
        n.add_builddir_to_rtp()
        local w = curwin()
        for _, helpcmd in ipairs({
          'help',
          'helpgrep api-types',
          'lhelpgrep api-types',
        }) do
          command(helpcmd)
          local badwins = {
            api.nvim_open_win(0, false, { focusable = false, relative = 'editor', width = 1, height = 1, row = 0, col = 0 }),
            api.nvim_open_win(0, false, { hide = true, relative = 'editor', width = 1, height = 1, row = 0, col = 0 }),
          }
          command('helpclose')