aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/jsx_spec.lua
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-01-04 01:57:40 +0900
committerStephan Seitz <stephan.seitz@fau.de>2023-01-04 12:14:03 +0100
commit2cd89b4bc32911cf0998de6d8c7602eabf9dd137 (patch)
tree5f608608f579a3fda6bf7893f5d986a633f559ed /tests/indent/jsx_spec.lua
parentfix(html): fix wrong indents for script/style tags (diff)
downloadnvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar.gz
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar.bz2
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar.lz
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar.xz
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.tar.zst
nvim-treesitter-2cd89b4bc32911cf0998de6d8c7602eabf9dd137.zip
fix(jsx): add missing indent end mark to elements
Diffstat (limited to 'tests/indent/jsx_spec.lua')
-rw-r--r--tests/indent/jsx_spec.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/indent/jsx_spec.lua b/tests/indent/jsx_spec.lua
new file mode 100644
index 000000000..e75b21f4f
--- /dev/null
+++ b/tests/indent/jsx_spec.lua
@@ -0,0 +1,43 @@
+local Runner = require("tests.indent.common").Runner
+local runner = Runner:new(it, "tests/indent/jsx", {
+ tabstop = 2,
+ shiftwidth = 2,
+ expandtab = true,
+ filetype = "jsx",
+})
+
+describe("indent JSX Elements:", function()
+ describe("whole file:", function()
+ runner:whole_file(".", {
+ expected_failures = {},
+ })
+ end)
+
+ describe("new line:", function()
+ for _, info in ipairs {
+ { 5, 8 },
+ { 6, 6 },
+ { 7, 6 },
+ { 8, 4 },
+ { 9, 2 },
+ } do
+ runner:new_line("issue-3986.jsx", { on_line = info[1], text = "text", indent = info[2] })
+ end
+ for _, info in ipairs {
+ { 4, 8 },
+ { 6, 10 },
+ { 9, 8 },
+ { 11, 8 },
+ } do
+ runner:new_line("element_attributes.jsx", { on_line = info[1], text = "disabled", indent = info[2] })
+ end
+
+ for _, info in ipairs {
+ { 5, 10 },
+ { 7, 8 },
+ { 11, 10 },
+ } do
+ runner:new_line("jsx_expression.jsx", { on_line = info[1], text = "{disabled}", indent = info[2] })
+ end
+ end)
+end)