Files
test-repo/tests/format/js/conditional/comments.js
T
Alex Rattray 28d097bbf5 Add test cases for questioning ternaries (#13952)
## Description

Extracts test cases that I added for https://github.com/prettier/prettier/pull/13183 to make it easier to visualize the changes that PR makes, as @vjeux [requested](https://github.com/prettier/prettier/pull/13183#discussion_r990820889).

## Checklist

<!-- Please ensure you’ve done all of these things (if applicable). -->
<!-- You can replace the `[ ]` with `[x]` to mark each task as done. -->

- [x] I’ve added tests to confirm my change works.
- [x] I’ve read the [contributing guidelines](https://github.com/prettier/prettier/blob/main/CONTRIBUTING.md).

<!-- Please DO NOT remove the playground link -->

**✨[Try the playground for this PR](https://prettier.io/playground-redirect)✨**
2022-12-07 15:46:40 -05:00

123 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var inspect = 4 === util.inspect.length
? // node <= 0.8.x
(function(v, colors) {
return util.inspect(v, void 0, void 0, colors);
})
: // node > 0.8.x
(function(v, colors) {
return util.inspect(v, { colors: colors });
});
var inspect = 4 === util.inspect.length
? // node <= 0.8.x
(function(v, colors) {
return util.inspect(v, void 0, void 0, colors);
})
: // node > 0.8.x
(function(v, colors) {
return util.inspect(v, { colors: colors });
});
const extractTextPluginOptions = shouldUseRelativeAssetPaths
// Making sure that the publicPath goes back to to build folder.
? { publicPath: Array(cssFilename.split('/').length).join('../') } :
{};
const extractTextPluginOptions2 = shouldUseRelativeAssetPaths
? // Making sure that the publicPath goes back to to build folder.
{ publicPath: Array(cssFilename.split("/").length).join("../") }
: {};
const extractTextPluginOptions3 = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder.
? { publicPath: Array(cssFilename.split("/").length).join("../") }
: {};
const { configureStore } = process.env.NODE_ENV === "production"
? require("./configureProdStore") // a
: require("./configureDevStore"); // b
test /* comment
comment
comment
*/
? foo
: bar;
test
? /* comment
comment
comment
comment
*/
foo
: bar;
test
? /* comment
comment
comment
comment
*/
foo
: test
? /* comment
comment
comment */
foo
: bar;
test
? /* comment */
foo
: bar;
test
? foo
: /* comment
comment
comment
comment
*/
bar;
test
? foo
: /* comment
comment
comment
comment
A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement.
*/
test
? foo
: /* comment
comment
comment
*/
bar;
// It is at least possible to delete the extra newline that was
// unfortunately added before the second condition above:
test ?
foo :/* comment
comment
comment
comment
*/
test ?
foo :
/* comment
comment
comment
*/
bar;
test
? foo
: /* comment */
bar;
test ? test /* c
c */? foo : bar : bar;