feat(fps): Add refresh style display for telescope

This commit is contained in:
TJ DeVries
2022-06-11 14:57:10 -04:00
parent e6b69b1488
commit 26b357789b
33 changed files with 1550 additions and 1597 deletions
@@ -1,6 +1,4 @@
require("plenary.reload").reload_module "telescope"
local tester = require "telescope.pickers._test"
local tester = require "telescope.testharness"
local disp = function(val)
return vim.inspect(val, { newline = " ", indent = "" })
@@ -11,6 +9,7 @@ describe("builtin.find_files", function()
tester.run_file "find_files__readme"
end)
<<<<<<< HEAD
it("should be able to move selections", function()
tester.run_file "find_files__with_ctrl_n"
end)
@@ -19,6 +18,14 @@ describe("builtin.find_files", function()
{ sorting_strategy = "descending" },
{ sorting_strategy = "ascending" },
} do
=======
for _, configuration in
ipairs {
{ sorting_strategy = "descending" },
{ sorting_strategy = "ascending" },
}
do
>>>>>>> 20a1519 (feat(fps): Add refresh style display for telescope)
it("should not display devicons when disabled: " .. disp(configuration), function()
tester.run_string(string.format(
[[
@@ -0,0 +1,109 @@
local tester = require "telescope.testharness"
--[[
Available functions are
- fixtures/file_a.txt
- fixtures/file_abc.txt
--]]
describe("scroll_cycle", function()
it("should be able to cycle selections: cycle", function()
tester.run_string [[
runner.picker("find_files", "fixtures/file<c-p>", {
post_close = {
{ "lua/tests/fixtures/file_abc.txt", helper.get_selection_value },
},
}, {
sorting_strategy = "ascending",
scroll_strategy = "cycle",
})
]]
end)
for _, sorting in ipairs { "ascending", "descending" } do
for _, key in ipairs { "<c-n>", "<c-p>" } do
it(string.format("Cycle: %sx2 %s", key, sorting), function()
tester.run_string(([[
runner.picker("find_files", "fixtures/file%s%s", {
post_typed = {
{ "lua/tests/fixtures/file_a.txt", helper.get_selection_value },
},
}, {
sorting_strategy = "%s",
scroll_strategy = "cycle",
}
) ]]):format(key, key, sorting))
end)
it(string.format("Cycle: %sx3 %s", key, sorting), function()
tester.run_string(([[
runner.picker("find_files", "fixtures/file%s%s%s", {
post_typed = {
{ "lua/tests/fixtures/file_abc.txt", helper.get_selection_value },
},
}, {
sorting_strategy = "%s",
scroll_strategy = "cycle",
}
) ]]):format(key, key, key, sorting))
end)
end
end
it("should be able to cycle selections: limit", function()
tester.run_string [[
runner.picker("find_files", "fixtures/file<c-p>", {
post_close = {
{ "lua/tests/fixtures/file_a.txt", helper.get_selection_value },
},
}, {
sorting_strategy = "ascending",
scroll_strategy = "limit",
})
]]
end)
it("long: cycle to top", function()
tester.run_string [[
runner.picker("find_files", "fixtures/long<c-p>", {
post_close = {
{ "lua/tests/fixtures/long_11111111111.md", helper.get_selection_value },
},
}, {
sorting_strategy = "ascending",
scroll_strategy = "cycle",
height = 10,
})
]]
end)
it("long: cycle to top", function()
tester.run_string [[
runner.picker("find_files", "fixtures/long<c-n>", {
post_close = {
{ "lua/tests/fixtures/long_11111111111.md", helper.get_selection_value },
},
}, {
sorting_strategy = "descending",
scroll_strategy = "cycle",
height = 10,
})
]]
end)
it("long: smash <c-p>", function()
tester.run_string [[
runner.picker("find_files", "fixtures/long<c-p><c-p><c-p><c-p><c-p>", {
post_typed = {
{ "lua/tests/fixtures/long_111111.md", helper.get_selection_value },
},
}, {
sorting_strategy = "descending",
scroll_strategy = "cycle",
layout_config = {
height = 8,
},
})
]]
end)
end)
@@ -1,9 +1,4 @@
require("plenary.reload").reload_module "telescope"
local tester = require "telescope.pickers._test"
local log = require "telescope.log"
log.use_console = false
local tester = require "telescope.testharness"
describe("scrolling strategies", function()
it("should handle cycling for full list", function()
@@ -0,0 +1,39 @@
local testharness = require "telescope.testharness"
describe("testing harness", function()
it("should find the readme, using lowercase", function()
testharness.run_string [[
runner.picker('find_files', 'readme.md', {
post_typed = {
{ "> readme.md", GetPrompt },
{ " README.md", GetBestResult },
},
post_close = {
{ 'README.md', GetFile },
}
}, {
disable_devicons = true,
})
]]
end)
it("should find the readme, using uppercase", function()
testharness.run_string [[
runner.picker('find_files', 'RE', {
post_close = {
{ 'README.md', GetFile },
}
})
]]
end)
it("Should find telescope prompt file", function()
testharness.run_string [[
runner.picker('find_files', 'TelescopePrompt', {
post_close = {
{ 'TelescopePrompt.lua', GetFile },
}
})
]]
end)
end)