fix(indent): ecma - class method indentation

This commit is contained in:
Munif Tanjim 2022-02-26 19:59:48 +06:00 committed by Stephan Seitz
parent 1eaf0150c2
commit 20168d8e20
3 changed files with 34 additions and 1 deletions

View file

@ -5,7 +5,6 @@
(class_body)
(export_clause)
(formal_parameters)
(method_definition)
(named_imports)
(object)
(object_pattern)

View file

@ -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
}
}

View file

@ -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 },