);
}
== should collapse and remove the jsx space expr when it's not necessary ==
function test() {
return
{test}
{" "}
{test}
;
}
[expect]
function test() {
return (
{test} {test}
);
}
== should combine multiple jsx space exprs together ==
function test() {
return
{test}
{" "}
{" "} {" "}
{" "}
{test}
;
}
[expect]
function test() {
return (
{test}{" "}{test}
);
}
== should move a space from before a jsx space expr into the expression ==
function test() {
const t1 = {t} {" "} {u};
const t2 = {t} {" "} {" "} {u};
}
[expect]
function test() {
const t1 = {t}{" "}{u};
const t2 = {t}{" "}{u};
}
== should combine spaces when surrounded by text ==
function test() {
const t1 =
A {" "} B
;
const t2 =
A{" "} B
;
const t3 =
A{" "}B
;
}
[expect]
function test() {
const t1 =
A{" "}B
;
const t2 =
A{" "}B
;
const t3 =
A B
;
}
== should handle the added space exceeding the line width ==
const t1 = (
{" "}
);
const t2 = (
{" "}
);
[expect]
const t1 = (
{" "}
);
const t2 = (
{" "}
);
== should keep a space expr that's alone ==
const t1 = (
{" "}
);
[expect]
const t1 = (
{" "}
);
== should keep a space expr that's at the start ==
const t1 = (
{" "}
{other}
);
[expect]
const t1 = (
{" "}
{other}
);
== should keep a space expr that's at the end ==
const t1 =
{other}
{" "}
;
[expect]
const t1 = (
{other}
{" "}
);
== should always use a space with newline after a multi-line jsx element ==
const t1 = (
This is a test.
);
[expect]
const t1 = (
{" "}
This is a test.
);
== should always use a space with newline after a multi-line jsx fragment ==
const t1 = (
<>
> This is a test.
);
[expect]
const t1 = (
<>
>{" "}
This is a test.
);
== should always use a space with a newline before a multi-line jsx element ==
const t1 = (
Testing this out.
);
[expect]
const t1 = (
Testing{" "}
{" "}
this out.
);
== should always use a space with a newline before a multi-line jsx fragment ==
const t1 =
Testing <>> this out.
;
[expect]
const t1 = (
Testing{" "}
<>
>{" "}
this out.
);
== should handle scenario where jsx element is single line and inline between text ==
const t1 = (