From 20168d8e20ec8335fddba0f519f63f53db760d72 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Sat, 26 Feb 2022 19:59:48 +0600 Subject: fix(indent): ecma - class method indentation --- tests/indent/ecma/class.js | 20 ++++++++++++++++++++ tests/indent/javascript_spec.lua | 14 ++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/indent/ecma/class.js (limited to 'tests') diff --git a/tests/indent/ecma/class.js b/tests/indent/ecma/class.js new file mode 100644 index 000000000..e22cdef36 --- /dev/null +++ b/tests/indent/ecma/class.js @@ -0,0 +1,20 @@ +class IndentTest { + async isEqual(paramOne, paramTwo) { + if (paramOne === paramTwo) { + return true + } + + return false + } + + async isNotEqual( + paramOne, + paramTwo, + ) { + if (paramOne !== paramTwo) { + return true + } + + return false + } +} diff --git a/tests/indent/javascript_spec.lua b/tests/indent/javascript_spec.lua index 98c46d8ff..6af93c190 100644 --- a/tests/indent/javascript_spec.lua +++ b/tests/indent/javascript_spec.lua @@ -36,6 +36,20 @@ describe("indent JavaScript:", function() run:new_line("ecma/callback.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) end + for _, info in + ipairs { + { 1, 2 }, + { 2, 4 }, + { 3, 6 }, + { 5, 4 }, + { 8, 2 }, + { 11, 4 }, + { 13, 4 }, + } + do + run:new_line("ecma/class.js", { on_line = info[1], text = "//", indent = info[2] }, info[3], info[4]) + end + for _, info in ipairs { { 2, 2 }, -- cgit v1.2.3-70-g09d2