Fix ternary indent bug (#577)
* Add test.js files back to source control * Fix ternary indent bug (#564)master
parent
69b7bd3fa8
commit
86d1264097
|
@ -1,3 +1,2 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
test.js
|
||||
|
|
|
@ -774,10 +774,10 @@ function genericPrintNoParens(path, options, print) {
|
|||
concat([
|
||||
line,
|
||||
"? ",
|
||||
indent(options.tabWidth, path.call(print, "consequent")),
|
||||
indent(2, path.call(print, "consequent")),
|
||||
line,
|
||||
": ",
|
||||
indent(options.tabWidth, path.call(print, "alternate"))
|
||||
indent(2, path.call(print, "alternate"))
|
||||
])
|
||||
)
|
||||
])
|
||||
|
|
|
@ -49,3 +49,55 @@ const obj5 = conditionIsTruthy
|
|||
};
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test test.js 2`] = `
|
||||
"const obj0 = conditionIsTruthy ? shortThing : otherShortThing
|
||||
|
||||
const obj1 = conditionIsTruthy ? { some: \'long\', object: \'with\', lots: \'of\', stuff } : shortThing
|
||||
|
||||
const obj2 = conditionIsTruthy ? shortThing : { some: \'long\', object: \'with\', lots: \'of\', stuff }
|
||||
|
||||
const obj3 = conditionIsTruthy ? { some: \'eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\', object: \'with\', lots: \'of\', stuff } : shortThing
|
||||
|
||||
const obj4 = conditionIsTruthy ? shortThing : { some: \'eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\', object: \'with\', lots: \'of\', stuff }
|
||||
|
||||
const obj5 = conditionIsTruthy ? { some: \'long\', object: \'with\', lots: \'of\', stuff } : { some: \'eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\', object: \'with\', lots: \'of\', stuff }
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
const obj0 = conditionIsTruthy ? shortThing : otherShortThing;
|
||||
|
||||
const obj1 = conditionIsTruthy
|
||||
? { some: \"long\", object: \"with\", lots: \"of\", stuff }
|
||||
: shortThing;
|
||||
|
||||
const obj2 = conditionIsTruthy
|
||||
? shortThing
|
||||
: { some: \"long\", object: \"with\", lots: \"of\", stuff };
|
||||
|
||||
const obj3 = conditionIsTruthy
|
||||
? {
|
||||
some: \"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\",
|
||||
object: \"with\",
|
||||
lots: \"of\",
|
||||
stuff
|
||||
}
|
||||
: shortThing;
|
||||
|
||||
const obj4 = conditionIsTruthy
|
||||
? shortThing
|
||||
: {
|
||||
some: \"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\",
|
||||
object: \"with\",
|
||||
lots: \"of\",
|
||||
stuff
|
||||
};
|
||||
|
||||
const obj5 = conditionIsTruthy
|
||||
? { some: \"long\", object: \"with\", lots: \"of\", stuff }
|
||||
: {
|
||||
some: \"eeeeeeeeeeeeven looooooooooooooooooooooooooooooonger\",
|
||||
object: \"with\",
|
||||
lots: \"of\",
|
||||
stuff
|
||||
};
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
run_spec(__dirname);
|
||||
run_spec(__dirname, { tabWidth: 4 });
|
||||
|
|
Loading…
Reference in New Issue