Skip to content

Commit

Permalink
Add a test for visually selecting top level forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Olical committed Sep 23, 2023
1 parent e757bf6 commit d75689a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/nvim-paredit/text_object_selections_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ describe("form selections", function()
end)
end)

describe("top form selections", function()
vim.api.nvim_buf_set_option(0, "filetype", "clojure")

before_each(function()
keybindings.setup_keybindings({
keys = defaults.default_keys,
})
end)

it("should select the root form and not the siblings", function()
prepare_buffer({
content = {"(+ 1 2)", "(foo (a", "a)) (/ 6 2)"},
cursor = { 2, 6 },
})
feedkeys("vaF")
assert.are.same("(foo (a\na))", utils.get_selected_text())
end)

it("should select within the form", function()
prepare_buffer({
content = {"(+ 1 2)", "(foo (a", "a)) (/ 6 2)"},
cursor = { 2, 6 },
})
feedkeys("viF")
assert.are.same("foo (a\na)", utils.get_selected_text())
end)
end)

describe("element deletions", function()
vim.api.nvim_buf_set_option(0, "filetype", "clojure")

Expand Down

0 comments on commit d75689a

Please sign in to comment.