forked from projekt0n/github-nvim-theme
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request projekt0n#345 from tmillr/fix-options-darken-floats
fix(config): `options.darken.floats` is not used
- Loading branch information
Showing
6 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local assert = require('luassert') | ||
local t_util = require('github-theme._test.util') | ||
local C = require('github-theme.lib.color') | ||
local api = vim.api | ||
|
||
if not api.nvim_get_hl then | ||
return | ||
end | ||
|
||
describe('config > options > darken', function() | ||
before_each(function() | ||
require('github-theme.config').reset() | ||
end) | ||
|
||
describe('> floats', function() | ||
for _, variant in ipairs(require('github-theme.palette').themes) do | ||
-- TODO: see #324 | ||
local _it = variant:find('high[-_]*contrast') and pending or it | ||
|
||
_it(('should be enabled by default (%s)'):format(variant), function() | ||
require('github-theme').setup() | ||
vim.cmd.colorscheme({ args = { variant } }) | ||
local normal_float = t_util.get_hl('NormalFloat') | ||
local normal = t_util.get_hl('Normal') | ||
|
||
assert.is_true(require('github-theme.config').options.darken.floats) | ||
assert.are.not_equal(normal_float.bg, normal.bg) | ||
assert( | ||
C(('#%x'):format(normal_float.bg)):luminance() | ||
< C(('#%x'):format(normal.bg)):luminance(), | ||
('expected `bg` of `NormalFloat` (#%x) to be darker than `bg` of `Normal` (#%x)'):format( | ||
normal_float.bg, | ||
normal.bg | ||
) | ||
) | ||
end) | ||
|
||
it(('should be disabled when set to `false` (%s)'):format(variant), function() | ||
require('github-theme').setup({ options = { darken = { floats = false } } }) | ||
vim.cmd.colorscheme({ args = { variant } }) | ||
local normal_float = t_util.get_hl('NormalFloat') | ||
local normal = t_util.get_hl('Normal') | ||
|
||
assert.is_false(require('github-theme.config').options.darken.floats) | ||
assert.are.equal(normal_float.bg, normal.bg) | ||
end) | ||
end | ||
end) | ||
end) |