diff options
author | altermo <107814000+altermo@users.noreply.github.com> | 2024-07-11 18:16:51 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-16 15:07:40 +0200 |
commit | 118ae7e5ed6cfab6a49ec70c21da2b850161289c (patch) | |
tree | cabb27fa81e8d73fe2f9ec3176b94472411f3d5d /test/functional/plugin/tohtml_spec.lua | |
parent | a5d4e3467d4568e5ac804f8178dda054f5360b15 (diff) | |
download | rneovim-118ae7e5ed6cfab6a49ec70c21da2b850161289c.tar.gz rneovim-118ae7e5ed6cfab6a49ec70c21da2b850161289c.tar.bz2 rneovim-118ae7e5ed6cfab6a49ec70c21da2b850161289c.zip |
fix(tohtml): support ranges again
Diffstat (limited to 'test/functional/plugin/tohtml_spec.lua')
-rw-r--r-- | test/functional/plugin/tohtml_spec.lua | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/functional/plugin/tohtml_spec.lua b/test/functional/plugin/tohtml_spec.lua index be5bada901..827db8c0f3 100644 --- a/test/functional/plugin/tohtml_spec.lua +++ b/test/functional/plugin/tohtml_spec.lua @@ -176,6 +176,44 @@ describe(':TOhtml', function() }, fn.readfile(out_file)) end) + it('expected internal html generated from range', function() + insert([[ + line1 + line2 + line3 + ]]) + local ns = api.nvim_create_namespace '' + api.nvim_buf_set_extmark(0, ns, 0, 0, { end_col = 1, end_row = 1, hl_group = 'Visual' }) + exec('set termguicolors') + local bg = fn.synIDattr(fn.hlID('Normal'), 'bg#', 'gui') + local fg = fn.synIDattr(fn.hlID('Normal'), 'fg#', 'gui') + exec_lua [[ + local html = vim.cmd'2,2TOhtml' + ]] + local out_file = api.nvim_buf_get_name(api.nvim_get_current_buf()) + eq({ + '<!DOCTYPE html>', + '<html>', + '<head>', + '<meta charset="UTF-8">', + '<title></title>', + ('<meta name="colorscheme" content="%s"></meta>'):format(api.nvim_get_var('colors_name')), + '<style>', + '* {font-family: monospace}', + ('body {background-color: %s; color: %s}'):format(bg, fg), + '.Visual {background-color: #9b9ea4}', + '</style>', + '</head>', + '<body style="display: flex">', + '<pre><span class="Visual">', + 'l</span>ine2', + '', + '</pre>', + '</body>', + '</html>', + }, fn.readfile(out_file)) + end) + it('highlight attributes generated', function() --Make sure to uncomment the attribute in `html_syntax_match()` exec('hi LINE gui=' .. table.concat({ |