-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
101 additions
and
109 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,59 @@ | ||
const prettier = require("prettier"); | ||
const assert = require("assert"); | ||
import { format } from "prettier"; | ||
import assert from "assert"; | ||
import plugin from "./main.mjs"; | ||
|
||
assert.strictEqual( | ||
prettier.format("a{font-size: 1rem; height: 1rem;}", { | ||
await format("a{font-size: 1rem; height: 1rem;}", { | ||
parser: "css", | ||
plugins: ["."], | ||
plugins: [plugin], | ||
}), | ||
"a {\n height: 1rem;\n font-size: 1rem;\n}\n", | ||
"sorts given CSS" | ||
"sorts given CSS", | ||
); | ||
|
||
assert.strictEqual( | ||
prettier.format( | ||
"a{height: 1rem; margin-left: -#{$grid-default-gutter / 2};}", | ||
{ | ||
parser: "scss", | ||
plugins: ["."], | ||
} | ||
), | ||
await format("a{height: 1rem; margin-left: -#{$grid-default-gutter / 2};}", { | ||
parser: "scss", | ||
plugins: [plugin], | ||
}), | ||
"a {\n margin-left: -#{$grid-default-gutter / 2};\n height: 1rem;\n}\n", | ||
"sorts given SCSS" | ||
"sorts given SCSS", | ||
); | ||
|
||
assert.strictEqual( | ||
prettier.format( | ||
"a{\n // something \n font-size: @hi; \n height: 1rem; \n }", | ||
{ | ||
parser: "less", | ||
plugins: ["."], | ||
} | ||
), | ||
await format("a{\n // something \n font-size: @hi; \n height: 1rem; \n }", { | ||
parser: "less", | ||
plugins: [plugin], | ||
}), | ||
"a {\n height: 1rem;\n // something\n font-size: @hi;\n}\n", | ||
"sorts given Less" | ||
"sorts given Less", | ||
); | ||
|
||
assert.throws( | ||
() => prettier.format("/*/*/* x", { parser: "css", plugins: ["."] }), | ||
assert.rejects( | ||
() => format("/*/*/* x", { parser: "css", plugins: [plugin] }), | ||
"surfaces errors to Prettier" | ||
); | ||
|
||
assert.strictEqual( | ||
prettier.format( | ||
await format( | ||
"<style>a{\n font-size: 100%; /* font-size comment */ \n height: 1rem; \n }</style>", | ||
{ | ||
parser: "html", | ||
plugins: ["."], | ||
} | ||
plugins: [plugin], | ||
}, | ||
), | ||
"<style>\n a {\n height: 1rem;\n font-size: 100%; /* font-size comment */\n }\n</style>\n", | ||
"sorts embedded CSS with comment" | ||
"sorts embedded CSS with comment", | ||
); | ||
|
||
assert.strictEqual( | ||
prettier.format( | ||
await format( | ||
"a{\n font-size: 100%; /* font-size comment */ \n height: 1rem; \n }", | ||
{ | ||
parser: "css", | ||
plugins: ["."], | ||
} | ||
plugins: [plugin], | ||
}, | ||
), | ||
"a {\n height: 1rem;\n font-size: 100%; /* font-size comment */\n}\n", | ||
"sorts CSS with comment" | ||
"sorts CSS with comment", | ||
); |
This file was deleted.
Oops, something went wrong.