-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: π singleQuote option does not work on format API (#2303)
* fix: π singleQuote option does not work on format API * test: π add test for singleQuote option from api call * refactor: π‘ add comment * style: π apply formatter
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import prettier from "prettier/standalone"; | ||
import * as prettierPluginPhp from "../../src/index.mjs"; | ||
|
||
// https://github.com/prettier/plugin-php/issues/2302 | ||
test(`singleQuote option on format api`, async () => { | ||
const input = `<?php echo link_to_route("frontend.users.user.show", $users["name"], $users['_id']); ?>`; | ||
const result = await prettier.format(input, { | ||
plugins: [prettierPluginPhp], | ||
singleQuote: true, | ||
parser: "php", | ||
}); | ||
|
||
const expected = `<?php echo link_to_route( | ||
'frontend.users.user.show', | ||
$users['name'], | ||
$users['_id'] | ||
); ?> | ||
`; | ||
|
||
expect(result).toEqual(expected); | ||
}); |