From 0d5e1214a5c386a168dc8e19d7da0ceb0e0bd6f2 Mon Sep 17 00:00:00 2001 From: Dennis van den Berg Date: Tue, 16 Jul 2024 20:29:19 +0200 Subject: feat: add indentation queries for angular --- tests/indent/angular_spec.lua | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 tests/indent/angular_spec.lua (limited to 'tests/indent/angular_spec.lua') diff --git a/tests/indent/angular_spec.lua b/tests/indent/angular_spec.lua new file mode 100644 index 000000000..2090420ce --- /dev/null +++ b/tests/indent/angular_spec.lua @@ -0,0 +1,70 @@ +local Runner = require("tests.indent.common").Runner +local runner = Runner:new(it, "tests/indent/angular", { + tabstop = 2, + shiftwidth = 2, + expandtab = true, + filetype = "htmlangular", +}) + +describe("indent HTML Angular:", function() + describe("whole file:", function() + runner:whole_file "." + end) + + describe("new line:", function() + for _, info in ipairs { + { 1, 2 }, + { 2, 2 }, + { 3, 2 }, + { 4, 2 }, + { 6, 0 }, + { 7, 2 }, + { 8, 4 }, + { 10, 4 }, + { 11, 6 }, + { 12, 6 }, + { 13, 4 }, + { 14, 2 }, + } do + runner:new_line("if-else.html", { on_line = info[1], text = "//", indent = info[2] }) + end + + for _, info in ipairs { + { 1, 2 }, + { 2, 4 }, + { 3, 6 }, + { 4, 6 }, + { 6, 6 }, + { 7, 6 }, + { 9, 6 }, + { 10, 6 }, + { 12, 2 }, + } do + runner:new_line("switch-case.html", { on_line = info[1], text = "//", indent = info[2] }) + end + + for _, info in ipairs { + { 1, 2 }, + { 2, 2 }, + { 3, 2 }, + { 4, 2 }, + { 5, 0 }, + } do + runner:new_line("for.html", { on_line = info[1], text = "//", indent = info[2] }) + end + + for _, info in ipairs { + { 1, 2 }, + { 2, 2 }, + { 3, 2 }, + { 4, 2 }, + { 5, 2 }, + { 6, 2 }, + { 7, 2 }, + { 8, 2 }, + { 9, 0 }, + } do + runner:new_line("defer.html", { on_line = info[1], text = "//", indent = info[2] }) + end + end) +end) -- cgit v1.2.3-70-g09d2