Fix missing dangling comments in arrays (#744)

* Add missing dangling comments printing in arrays.

* Update tests accordingly.
master
Davy Duperron 2017-02-20 02:25:18 +01:00 committed by Christopher Chedeau
parent 1affecc1a0
commit 0f34fb91eb
3 changed files with 11 additions and 0 deletions

View File

@ -814,6 +814,7 @@ function genericPrintNoParens(path, options, print) {
? "," ? ","
: "" : ""
), ),
comments.printDanglingComments(path, options, /* sameIndent */ true),
softline, softline,
"]" "]"
]) ])

View File

@ -94,12 +94,16 @@ exports[`test dangling_array.js 1`] = `
"expect(() => {}).toTriggerReadyStateChanges([ "expect(() => {}).toTriggerReadyStateChanges([
// Nothing. // Nothing.
]); ]);
[1 /*first comment */, 2 /* second comment */, 3];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
expect(() => {}).toTriggerReadyStateChanges( expect(() => {}).toTriggerReadyStateChanges(
[ [
// Nothing. // Nothing.
] ]
); );
[1 /*first comment */, 2 /* second comment */, 3];
" "
`; `;
@ -107,12 +111,16 @@ exports[`test dangling_array.js 2`] = `
"expect(() => {}).toTriggerReadyStateChanges([ "expect(() => {}).toTriggerReadyStateChanges([
// Nothing. // Nothing.
]); ]);
[1 /*first comment */, 2 /* second comment */, 3];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
expect(() => {}).toTriggerReadyStateChanges( expect(() => {}).toTriggerReadyStateChanges(
[ [
// Nothing. // Nothing.
] ]
); );
[1 /*first comment */, 2 /* second comment */, 3];
" "
`; `;

View File

@ -1,3 +1,5 @@
expect(() => {}).toTriggerReadyStateChanges([ expect(() => {}).toTriggerReadyStateChanges([
// Nothing. // Nothing.
]); ]);
[1 /*first comment */, 2 /* second comment */, 3];