aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/css_spec.lua
diff options
context:
space:
mode:
authorDaniel Woznicki <danwoz@nettoolkit.com>2022-03-18 14:13:27 -0700
committerStephan Seitz <stephan.seitz@fau.de>2022-03-19 12:29:36 +0100
commitb1380560a0f8fe339109ac33840eea5b0ac91cc4 (patch)
tree7c71e7dcef0c94b0a6ddd306c62f2a0647e2bfd1 /tests/indent/css_spec.lua
parentedit(readme): note about the configuration filetypes (diff)
downloadnvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar.gz
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar.bz2
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar.lz
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar.xz
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.tar.zst
nvim-treesitter-b1380560a0f8fe339109ac33840eea5b0ac91cc4.zip
Added fix for incorrect CSS indent after closing bracket
Added a failing test for possible broken CSS syntax tree
Diffstat (limited to 'tests/indent/css_spec.lua')
-rw-r--r--tests/indent/css_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/indent/css_spec.lua b/tests/indent/css_spec.lua
new file mode 100644
index 000000000..3d758ebac
--- /dev/null
+++ b/tests/indent/css_spec.lua
@@ -0,0 +1,28 @@
+local Runner = require("tests.indent.common").Runner
+local XFAIL = require("tests.indent.common").XFAIL
+
+local run = Runner:new(it, "tests/indent/css", {
+ tabstop = 2,
+ shiftwidth = 2,
+ softtabstop = 0,
+ expandtab = true,
+})
+
+describe("indent CSS:", function()
+ describe("whole file:", function()
+ run:whole_file(".", {
+ expected_failures = {},
+ })
+ end)
+
+ describe("new line:", function()
+ run:new_line("closing.css", { on_line = 1, text = "}", indent = 0 })
+ run:new_line(
+ "block.css",
+ { on_line = 1, text = "color: green;", indent = 2 },
+ "might fail because tree is in a broken state",
+ XFAIL
+ )
+ run:new_line("next_rule.css", { on_line = 3, text = ".next {", indent = 0 })
+ end)
+end)