canola.nvim/spec/close_spec.lua
Barrett Ruth e6b42168c9
refactor: rename oil to canola across entire codebase
Problem: the codebase still used the upstream \`oil\` naming everywhere —
URL schemes, the \`:Oil\` command, highlight groups, user events, module
paths, filetypes, buffer/window variables, LuaCATS type annotations,
vimdoc help tags, syntax groups, and internal identifiers.

Solution: mechanical rename of every reference. URL schemes now use
\`canola://\` (plus \`canola-ssh://\`, \`canola-s3://\`, \`canola-sss://\`,
\`canola-trash://\`, \`canola-test://\`). The \`:Canola\` command replaces
\`:Oil\`. All highlight groups, user events, augroups, namespaces,
filetypes, require paths, type annotations, help tags, and identifiers
follow suit. The \`upstream\` remote to \`stevearc/oil.nvim\` has been
removed and the \`vim.g.oil\` deprecation shim dropped.
2026-03-05 14:49:25 -05:00

44 lines
1.3 KiB
Lua

local canola = require('canola')
local test_util = require('spec.test_util')
describe('close', function()
before_each(function()
test_util.reset_editor()
end)
after_each(function()
test_util.reset_editor()
end)
it('does not close buffer from visual mode', function()
canola.open()
test_util.wait_for_autocmd({ 'User', pattern = 'CanolaEnter' })
assert.equals('canola', vim.bo.filetype)
test_util.feedkeys({ 'V' }, 10)
canola.close()
assert.equals('canola', vim.bo.filetype)
test_util.feedkeys({ '<Esc>' }, 10)
end)
it('does not close buffer from operator-pending mode', function()
canola.open()
test_util.wait_for_autocmd({ 'User', pattern = 'CanolaEnter' })
assert.equals('canola', vim.bo.filetype)
vim.api.nvim_feedkeys('d', 'n', false)
vim.wait(20)
local mode = vim.api.nvim_get_mode().mode
if mode:match('^no') then
canola.close()
assert.equals('canola', vim.bo.filetype)
end
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<Esc>', true, true, true), 'n', false)
vim.wait(20)
end)
it('closes buffer from normal mode', function()
canola.open()
test_util.wait_for_autocmd({ 'User', pattern = 'CanolaEnter' })
assert.equals('canola', vim.bo.filetype)
canola.close()
assert.not_equals('canola', vim.bo.filetype)
end)
end)