mirror of
https://github.com/maxmx03/solarized.nvim.git
synced 2026-09-10 07:26:26 -04:00
73 lines
1.7 KiB
Lua
73 lines
1.7 KiB
Lua
local nvim_get_hl = require('solarized.utils').nvim_get_hl
|
|
|
|
describe('solarized.setup', function()
|
|
setup(function()
|
|
vim.o.background = 'light'
|
|
---@type solarized
|
|
local solarized = require 'solarized'
|
|
|
|
solarized.setup {
|
|
transparent = {
|
|
enabled = true,
|
|
},
|
|
styles = {
|
|
strings = { italic = true },
|
|
comments = { bold = true },
|
|
},
|
|
on_colors = function()
|
|
return {
|
|
mycolor = '#ffffff',
|
|
}
|
|
end,
|
|
on_highlights = function(colors)
|
|
return {
|
|
---@diagnostic disable-next-line: undefined-field
|
|
CustomHighlight = { fg = colors.mycolor },
|
|
}
|
|
end,
|
|
}
|
|
vim.cmd 'colorscheme solarized'
|
|
end)
|
|
|
|
test('transparent', function()
|
|
local normal = nvim_get_hl 'Normal'
|
|
assert.falsy(normal.bg)
|
|
end)
|
|
|
|
test('on_colors and on_highlight', function()
|
|
local user_group = nvim_get_hl 'CustomHighlight'
|
|
local expected = { fg = '#FFFFFF' }
|
|
assert.are.same(expected, user_group)
|
|
end)
|
|
|
|
test('styles', function()
|
|
local strings = nvim_get_hl 'String'
|
|
local comments = nvim_get_hl 'Comment'
|
|
assert.True(strings.italic)
|
|
assert.True(comments.bold)
|
|
end)
|
|
|
|
test('styles.enabled', function()
|
|
local solarized = require 'solarized'
|
|
solarized.setup {
|
|
styles = {
|
|
enabled = false,
|
|
strings = { italic = true },
|
|
comments = { bold = true },
|
|
},
|
|
}
|
|
vim.cmd 'colorscheme solarized'
|
|
|
|
local strings = nvim_get_hl 'String'
|
|
local comments = nvim_get_hl 'Comment'
|
|
assert.Nil(strings.italic)
|
|
assert.Nil(comments.bold)
|
|
end)
|
|
|
|
test('nil config', function()
|
|
local solarized = require 'solarized'
|
|
solarized.setup()
|
|
vim.cmd 'colorscheme solarized'
|
|
end)
|
|
end)
|