-
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.
- Loading branch information
1 parent
5ba49e6
commit 5e896e4
Showing
1 changed file
with
51 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
describe('config', function() | ||
-- NOTE: keep this test on the top so that it has default cursor | ||
-- in other case our property will clear it | ||
it('should not overwrite a cursor', function() | ||
local current_cursor = table.concat(vim.opt.guicursor:get(), ',') | ||
|
||
local cursor = require 'cursor' | ||
|
||
cursor.setup { | ||
overwrite_cursor = false, | ||
cursors = { | ||
{ mode = 'a', shape = 'block' }, | ||
{ mode = 'v', shape = 'ver', size = 25 }, | ||
}, | ||
} | ||
|
||
assert.are.equal(current_cursor .. ',a:block,v:ver25', table.concat(vim.opt.guicursor:get(), ',')) | ||
end) | ||
|
||
it('should overwrite a cursor', function() | ||
local cursor = require 'cursor' | ||
|
||
cursor.setup { | ||
overwrite_cursor = true, | ||
cursors = { | ||
{ mode = 'a', shape = 'block' }, | ||
{ mode = 'i', shape = 'ver', size = 25 }, | ||
}, | ||
} | ||
|
||
assert.are.equal('a:block,i:ver25', table.concat(vim.opt.guicursor:get(), ',')) | ||
end) | ||
|
||
it('should apply cursors correctly', function() | ||
local cursor = require 'cursor' | ||
|
||
cursor.setup { | ||
cursors = { | ||
{ mode = 'i', blink = 300, shape = 'hor', size = 40, hl = 'Cursor' }, | ||
{ mode = 'v', shape = 'block', hl = 'VCursor' }, | ||
{ mode = 'n', shape = 'block', hl = 'NCursor' }, | ||
}, | ||
overwrite_cursor = true, | ||
} | ||
|
||
assert.are.equal( | ||
'i:hor40-Cursor-blinkwait300-blinkon300-blinkoff300,v:block-VCursor,n:block-NCursor', | ||
table.concat(vim.opt.guicursor:get(), ',') | ||
) | ||
end) | ||
end) |