---
source: crates/rome_formatter_test/src/snapshot_builder.rs
info:
test_file: jsx/text-wrap/test.js
---
# Input
```js
// Wrapping text
x =
Some text that would need to wrap on to a new line in order to display correctly and nicely
// Wrapping tags
x =
f f f f f f
// Wrapping tags
x =
f f f f f f
// Wrapping tags
x =
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f
// Wrapping tags
x =
f
x =
before
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mollis lorem.
after
x =
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}{stuff}{stuff}after{stuff}after
x =
before {stuff} after {stuff} after {stuff} after {stuff} after {stuff} after {stuff} {stuff} {stuff} after {stuff} after
x =
Please state your name and occupation for the board of school directors.
function DiffOverview(props) {
const { source, target, since } = props;
return (
This diff overview is computed against the current list of records in
this collection and the list it contained on {humanDate(since)} .
Note: last_modified
and schema
record metadata
are omitted for easier review.
);
}
x = Starting at minute {graphActivity.startTime}, running for {graphActivity.length} to minute {graphActivity.startTime + graphActivity.length}
x =
First second third
Something
x =
x =
leading_whitespace =
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
trailing_whitespace =
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
no_leading_or_trailing_whitespace =
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh Twelfth Thirteenth Fourteenth
facebook_translation_leave_text_around_tag =
First
,
(
Second
)
x =
First second third fourth fifth sixth seventh
,
(
Second
)
this_really_should_split_across_lines =
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after
unstable_before =
Your score: {`${mini.crosstable.users[sessionUserId]} - ${mini.crosstable.users[user.id]}`}
unstable_after_first_run = (
Your score:{" "}
{`${mini.crosstable.users[sessionUserId]} - ${mini
.crosstable.users[user.id]}`}
);
solitary_whitespace =
jsx_whitespace_on_newline =
jsx_around_multiline_element =
Before
{"Enough text to make this element wrap on to multiple lines when formatting"}
After
jsx_around_multiline_element_second_pass = (
Before{" "}
{
"Enough text to make this element wrap on to multiple lines when formatting"
}
{" "}
After
);
convert_space_expressions =
{" "}
x =
const Abc = () => {
return (
Please state your
{" "}
name
{" "}
and
{" "}
occupation
{" "}
for the board of directors.
);
};
x = Some stuff here
headers_and_paragraphs = (
First
The first paragraph.
Second
The second paragraph.
);
no_text_one_tag_per_line =
with_text_fill_line =
Text
line_after_br =
Text
More text
And more
line_after_br =
Text More text And more
line_after_br =
Text
More text
And more
line_after_br_2 = A B C
br_followed_by_whitespace = text
dont_preserve_blank_lines_when_jsx_contains_text =
multiple_expressions =
{header}
{body}
{footer}
single_expression_child_tags =
You currently have {dashboardStr} and {userStr}
expression_does_not_break =
texty text text text text text text text text text text text {this.props.type}
// FIXME
br_triggers_expression_break =
text text text text text text text text text text text {this.props.type}
jsx_whitespace_after_tag =
{variable}
{" "}
({variable})
x =
ENDS IN
text text text text text text text text text text text
{" "}
HRS
x =
Message
Hello, I'm a simple message.
x =
Hello, I'm a simple message.
Message
x =
Line {startRange.row + 1}:{startRange.column + 1} - {endRange.row + 1}:{endRange.column + 1}{caller}
x =
// NOTE: Multiple JSX whitespaces are collapsed into a single space.
x =
{" "}{" "}{" "}
// Don't break a self-closing element without attributes
// ----------
x =
text text text text text text text text text text text text text text text text text text text text text
;
x =
x =
x =
x =
x =
x =
x =
{hour}:{minute}:{second}
x =
{hour}
:
{minute}
:
{second}
x =
{hour}:
{minute}:
{second}
x = text here .
x = Sales tax estimated using a rate of {salesTax * 100}%.
x =
{title}
x = bar
x =
{name} ’s{' '}
Hello world .
You {type}ed this shipment to
x =
{parameter.Description}: {errorMsg}
x =
{value} solution{plural}
x = Copy "{name}"
x = (avg. {value}/5)
x =
Use the Button
's
;
this_really_should_split_across_lines =
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after
let myDiv = ReactTestUtils.renderIntoDocument(
);
```
# Prettier differences
```diff
--- Prettier
+++ Rome
@@ -318,7 +318,11 @@
line_after_br_2 = (
- A B C
+ A
+
+ B
+
+ C
);
@@ -331,6 +335,7 @@
dont_preserve_blank_lines_when_jsx_contains_text = (
```
# Output
```js
// Wrapping text
x = (
Some text that would need to wrap on to a new line in order to display
correctly and nicely
);
// Wrapping tags
x = (
f f f f {" "}
f f
);
// Wrapping tags
x = (
f
f
f
f
f
f
);
// Wrapping tags
x = (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {" "}
f
);
// Wrapping tags
x = (
{" "}
f
);
x = (
before
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at
mollis lorem.
after
);
x = (
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}
{stuff}
{stuff}after{stuff}after
);
x = (
before {stuff} after {stuff} after {stuff} after {stuff} after {stuff} after{" "}
{stuff} {stuff} {stuff} after {stuff} after
);
x = (
Please state your name and occupation for the board of{" "}
school directors.
);
function DiffOverview(props) {
const { source, target, since } = props;
return (
This diff overview is computed against the current list of records in
this collection and the list it contained on {humanDate(since)}
.
Note: last_modified
and schema
record
metadata are omitted for easier review.
);
}
x = (
Starting at minute {graphActivity.startTime}, running for{" "}
{graphActivity.length} to minute{" "}
{graphActivity.startTime + graphActivity.length}
);
x = (
First second third
Something
);
x = (
);
x = (
);
leading_whitespace = (
{" "}
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
Twelfth Thirteenth Fourteenth
);
trailing_whitespace = (
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
Twelfth Thirteenth Fourteenth{" "}
);
no_leading_or_trailing_whitespace = (
First Second Third Fourth Fifth Sixth Seventh Eighth Ninth Tenth Eleventh
Twelfth Thirteenth Fourteenth
);
facebook_translation_leave_text_around_tag = (
First , (Second )
);
x = (
First second third fourth fifth sixth seventh , (
Second )
);
this_really_should_split_across_lines = (
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}
after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}
after{stuff}after{stuff}after
);
unstable_before = (
Your score:{" "}
{`${mini.crosstable.users[sessionUserId]} - ${
mini.crosstable.users[user.id]
}`}
);
unstable_after_first_run = (
Your score:{" "}
{`${mini.crosstable.users[sessionUserId]} - ${
mini.crosstable.users[user.id]
}`}
);
solitary_whitespace = (
{" "}
);
jsx_whitespace_on_newline = (
);
jsx_around_multiline_element = (
Before{" "}
{
"Enough text to make this element wrap on to multiple lines when formatting"
}
{" "}
After
);
jsx_around_multiline_element_second_pass = (
Before{" "}
{
"Enough text to make this element wrap on to multiple lines when formatting"
}
{" "}
After
);
convert_space_expressions =
;
x = (
);
const Abc = () => {
return (
Please state your name and occupation for the board of
directors.
);
};
x = Some stuff here
;
headers_and_paragraphs = (
First
The first paragraph.
Second
The second paragraph.
);
no_text_one_tag_per_line = (
);
with_text_fill_line = (
Text
);
line_after_br = (
Text
More text
And more
);
line_after_br = (
Text
More text
And more
);
line_after_br = (
Text
More text
And more
);
line_after_br_2 = (
A
B
C
);
br_followed_by_whitespace = (
text
);
dont_preserve_blank_lines_when_jsx_contains_text = (
);
multiple_expressions = (
{header}
{body}
{footer}
);
single_expression_child_tags = (
You currently have {dashboardStr} and{" "}
{userStr}
);
expression_does_not_break = (
texty text text text text text text text text text text text{" "}
{this.props.type}{" "}
);
// FIXME
br_triggers_expression_break = (
text text text text text text text text text text text {
this.props.type
}{" "}
);
jsx_whitespace_after_tag = (
{variable}
{" "}
({variable})
);
x = (
ENDS IN
text text text text text text text text text text text
{" "}
HRS
);
x = (
Message
Hello, I'm a simple message.
);
x = (
Hello, I'm a simple message.
Message
);
x = (
Line {startRange.row + 1}:{startRange.column + 1} -{" "}
{endRange.row + 1}:{endRange.column + 1}
{caller}
);
x = (
);
// NOTE: Multiple JSX whitespaces are collapsed into a single space.
x =
;
// Don't break a self-closing element without attributes
// ----------
x = (
text text text text text text text text text text text text text text text
text text text text text text
);
x = (
);
x = (
);
x = (
);
x = (
);
x = (
);
x = (
);
x = (
{hour}:{minute}:{second}
);
x = (
{hour}:{minute}:{second}
);
x = (
{hour}:{minute}:{second}
);
x = (
text here .
);
x = Sales tax estimated using a rate of {salesTax * 100}%.
;
x = {title}
;
x = (
bar
);
x = (
{name} ’s{" "}
Hello world .
You {type}ed this shipment to
);
x = (
{parameter.Description}: {errorMsg}
);
x = (
{value} solution{plural}
);
x = Copy "{name}" ;
x = (avg. {value}/5) ;
x = (
Use the Button
's
);
this_really_should_split_across_lines = (
before{stuff}after{stuff}after{stuff}after{stuff}after{stuff}after{stuff}
after{stuff}after
);
let myDiv = ReactTestUtils.renderIntoDocument(
,
);
```
# Lines exceeding max width of 80 characters
```
69: before {stuff} after {stuff} after {stuff} after {stuff} after {stuff} after{" "}
114:
219: "Enough text to make this element wrap on to multiple lines when formatting"
231: "Enough text to make this element wrap on to multiple lines when formatting"
387: ENDS IN
text text text text text text text text text text text
{" "}
```