@@ -1,12 +1,16 @@
|
||||
require('plenary.reload').reload_module('telescope')
|
||||
|
||||
local tester = require('telescope.pickers._tests')
|
||||
local tester = require('telescope.pickers._test')
|
||||
|
||||
describe('builtin.find_files', function()
|
||||
it('should find the readme', function()
|
||||
tester.run_file('find_files__readme')
|
||||
end)
|
||||
|
||||
it('should be able to move selections', function()
|
||||
tester.run_file('find_files__with_ctrl_n')
|
||||
end)
|
||||
|
||||
it('should not display devicons when disabled', function()
|
||||
tester.run_string [[
|
||||
tester.builtin_picker('find_files', 'README.md', {
|
||||
@@ -105,4 +109,14 @@ describe('builtin.find_files', function()
|
||||
})
|
||||
]]
|
||||
end)
|
||||
|
||||
it('should be able to get the current selection', function()
|
||||
tester.run_string [[
|
||||
tester.builtin_picker('find_files', 'fixtures/file_abc', {
|
||||
post_typed = {
|
||||
{ 'lua/tests/fixtures/file_abc.txt', GetSelectionValue },
|
||||
}
|
||||
})
|
||||
]]
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local tester = require('telescope.pickers._tests')
|
||||
local tester = require('telescope.pickers._test')
|
||||
|
||||
tester.builtin_picker('find_files', 'README.md', {
|
||||
post_close = {
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
pcall(function() RELOAD('telescope') end)
|
||||
local tester = require('telescope.pickers._test')
|
||||
local helper = require('telescope.pickers._test_helpers')
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
local tester = require('telescope.pickers._tests')
|
||||
|
||||
local key = 'find_files'
|
||||
local input = 'fixtures/file<c-p>'
|
||||
local expected = 'lua/tests/fixtures/file_2.txt'
|
||||
local get_actual = function()
|
||||
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":.")
|
||||
end
|
||||
|
||||
-- local on_complete_item = tester.picker_feed(input, expected, get_actual, true)
|
||||
--
|
||||
-- builtin[key] {
|
||||
-- on_complete = { on_complete_item }
|
||||
-- }
|
||||
|
||||
tester.builtin_picker('find_files', 'fixtures/file<c-p>', 'lua/tests/fixtures/file_2.txt', function()
|
||||
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":.")
|
||||
end, {
|
||||
debug = false,
|
||||
tester.builtin_picker('find_files', 'fixtures/file<c-p>', {
|
||||
post_close = {
|
||||
{ 'lua/tests/fixtures/file_2.txt', helper.get_file }
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user