This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(rome_js_formatter): Add prettier's JSX tests (#3255)
- Loading branch information
1 parent
51f9f0f
commit 9a767d6
Showing
91 changed files
with
6,710 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
...es/rome_js_formatter/tests/specs/prettier/js/export/blank-line-between-specifiers.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,3 @@ if ( | |
) { | ||
a; | ||
} | ||
|
||
if ( | ||
// comment | ||
1 | ||
) { | ||
b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/re-export.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { foo2 } from "foo.json" assert { type: "json" }; | ||
export { default as foo2 } from "foo.json" assert { type: "json" }; | ||
export * from "foo.json" assert { type: "json" }; | ||
export * as foo3 from "foo.json" assert { type: "json" }; |
2 changes: 1 addition & 1 deletion
2
...es/rome_js_formatter/tests/specs/prettier/js/import-assertions/re-export.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { foo2 } from "foo.json" assert { type: "json" }; | ||
export { default as foo2 } from "foo.json" assert { type: "json" }; | ||
export * from "foo.json" assert { type: "json" }; | ||
export * as foo3 from "foo.json" assert { type: "json" }; |
8 changes: 8 additions & 0 deletions
8
crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
foo(_a).bar().leet(); | ||
foo(-a).bar().leet(); | ||
foo(+a).bar().leet(); | ||
foo(~a).bar().leet(); | ||
foo(++a).bar().leet(); | ||
foo(--a).bar().leet(); | ||
foo(a++).bar().leet(); | ||
foo(a--).bar().leet(); |
20 changes: 20 additions & 0 deletions
20
crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
foo(_a).bar().leet(); | ||
foo(-a).bar().leet(); | ||
foo(+a) | ||
.bar() | ||
.leet(); | ||
foo(~a) | ||
.bar() | ||
.leet(); | ||
foo(++a) | ||
.bar() | ||
.leet(); | ||
foo(--a) | ||
.bar() | ||
.leet(); | ||
foo(a++) | ||
.bar() | ||
.leet(); | ||
foo(a--) | ||
.bar() | ||
.leet(); |
69 changes: 69 additions & 0 deletions
69
crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
source: crates/rome_js_formatter/tests/prettier_tests.rs | ||
info: | ||
test_file: js/method-chain/13018.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
foo(_a).bar().leet(); | ||
foo(-a).bar().leet(); | ||
foo(+a).bar().leet(); | ||
foo(~a).bar().leet(); | ||
foo(++a).bar().leet(); | ||
foo(--a).bar().leet(); | ||
foo(a++).bar().leet(); | ||
foo(a--).bar().leet(); | ||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -1,20 +1,8 @@ | ||
foo(_a).bar().leet(); | ||
foo(-a).bar().leet(); | ||
-foo(+a) | ||
- .bar() | ||
- .leet(); | ||
-foo(~a) | ||
- .bar() | ||
- .leet(); | ||
-foo(++a) | ||
- .bar() | ||
- .leet(); | ||
-foo(--a) | ||
- .bar() | ||
- .leet(); | ||
-foo(a++) | ||
- .bar() | ||
- .leet(); | ||
-foo(a--) | ||
- .bar() | ||
- .leet(); | ||
+foo(+a).bar().leet(); | ||
+foo(~a).bar().leet(); | ||
+foo(++a).bar().leet(); | ||
+foo(--a).bar().leet(); | ||
+foo(a++).bar().leet(); | ||
+foo(a--).bar().leet(); | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
foo(_a).bar().leet(); | ||
foo(-a).bar().leet(); | ||
foo(+a).bar().leet(); | ||
foo(~a).bar().leet(); | ||
foo(++a).bar().leet(); | ||
foo(--a).bar().leet(); | ||
foo(a++).bar().leet(); | ||
foo(a--).bar().leet(); | ||
``` | ||
|
||
|
||
|
3 changes: 3 additions & 0 deletions
3
crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let fn =a((x ) => { | ||
<<<PRETTIER_RANGE_START>>> quux (); //<<<PRETTIER_RANGE_END>>> | ||
}); |
3 changes: 3 additions & 0 deletions
3
crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let fn = a((x) => { | ||
quux(); // | ||
}); |
37 changes: 37 additions & 0 deletions
37
crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
source: crates/rome_js_formatter/tests/prettier_tests.rs | ||
info: | ||
test_file: js/range/function-body.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
let fn =a((x ) => { | ||
quux (); // | ||
}); | ||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -1,3 +1,3 @@ | ||
-let fn = a((x) => { | ||
+let fn =a((x ) => { | ||
quux(); // | ||
}); | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
let fn =a((x ) => { | ||
quux(); // | ||
}); | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/strings/multiline-literal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// https://github.com/prettier/prettier/pull/13274 | ||
|
||
const loremIpsumFooBazBar1 = 'Multiline string\ | ||
Multiline string\ | ||
' | ||
|
||
const loremIpsumFooBazBar2 = 'Multiline string\ | ||
Multiline string\ | ||
Multiline string' |
10 changes: 10 additions & 0 deletions
10
crates/rome_js_formatter/tests/specs/prettier/js/strings/multiline-literal.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// https://github.com/prettier/prettier/pull/13274 | ||
|
||
const loremIpsumFooBazBar1 = "Multiline string\ | ||
Multiline string\ | ||
"; | ||
|
||
const loremIpsumFooBazBar2 = | ||
"Multiline string\ | ||
Multiline string\ | ||
Multiline string"; |
Oops, something went wrong.