Skip to content

Commit

Permalink
Add tests for html with injected javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaszczuk committed Feb 14, 2024
1 parent b8f2f74 commit 826999e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
function test() {
let test = "asdasd";



if test != "" {


Expand Down
50 changes: 49 additions & 1 deletion test/ts_context_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ describe('ts_context', function()
"lua",
"rust",
"cpp",
"typescript"
"typescript",
"html",
"javascript",
},
sync_install = true,
}
Expand Down Expand Up @@ -329,6 +331,52 @@ describe('ts_context', function()
]]}
end)

it('html', function()
cmd('edit test/test.html')
exec_lua [[vim.treesitter.start()]]

feed'100<C-e>'
screen:expect{grid=[[
{14:<html}{2: }{14:lang}{1:=}{10:"en"}{14:>}{2: }|
{2: }{14:<body>}{2: }|
{2: }{14:<ul>}{2: }|
{2: }{14:<li>}{2: }|
|
^ |
|*5
{15:</li>} |
{15:<li></li>} |
{15:</ul>} |
{15:</body>} |
|
]]}

feed'31<C-e>'
screen:expect{grid=[[
{14:<html}{2: }{14:lang}{1:=}{10:"en"}{14:>}{2: }|
{2: }{14:<script>}{2: }|
{2: }{1:function}{2: }{3:test}{14:()}{2: }{14:{}{2: }|
|
|
^ |
{4:if} {5:test} {4:!=} {11:""} {15:{} |
|*9
]]}

feed'4<C-e>'
screen:expect{grid=[[
{14:<html}{2: }{14:lang}{1:=}{10:"en"}{14:>}{2: }|
{2: }{14:<script>}{2: }|
{2: }{1:function}{2: }{3:test}{14:()}{2: }{14:{}{2: }|
{2: }{1:if}{2: }{3:test}{2: }{1:!=}{2: }{10:""}{2: }{14:{}{2: }|
|
^ |
|*6
{15:}} |
{15:}} |
|*2
]]}
end)
end)

end)

0 comments on commit 826999e

Please sign in to comment.