0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

prettier-plugin: Add a test for JSX embedded in an attribute. This test currently fails. (#508)

* Add a test for JSX embedded in an attribute. This test currently fails.

* Oops forgot the semicolons on the correct output

* Add `--scope prettier-plugin-astro` so that the prettier plugin is tested on default CI

* Replace `assert.equal` with `assert.fixture` to remain inline w/ main

* Update astro-prettier.test.js

* Skip the other failing test.

Co-authored-by: Fred K. Schott <fkschott@gmail.com>
This commit is contained in:
Caleb Jasik 2021-06-25 17:21:03 -05:00 committed by GitHub
parent 8aca0fabaf
commit 05d6fc66bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 2 deletions

View file

@ -17,7 +17,7 @@
"dev:vscode": "lerna run dev --scope astro-languageserver --scope astro-vscode --scope @astrojs/parser --parallel --stream",
"format": "prettier -w \"**/*.{js,jsx,ts,tsx,md,json}\"",
"lint": "eslint \"packages/**/*.ts\"",
"test": "lerna run test --scope astro --stream",
"test": "lerna run test --scope astro --scope prettier-plugin-astro --stream",
"test:core": "yarn workspace astro run test",
"test:templates": "lerna run test --scope create-astro --stream"
},

View file

@ -33,7 +33,7 @@ Prettier('can format an Astro file with frontmatter', async () => {
assert.fixture(formatted, out);
});
Prettier('can format an Astro file with embedded JSX expressions', async () => {
Prettier.skip('can format an Astro file with embedded JSX expressions', async () => {
const [src, out] = await getFiles('embedded-expr');
assert.not.fixture(src, out);
@ -41,4 +41,13 @@ Prettier('can format an Astro file with embedded JSX expressions', async () => {
assert.fixture(formatted, out);
});
// This is currently failing! See: https://github.com/snowpackjs/astro/issues/478
Prettier.skip('can format an Astro file with a JSX expression in an attribute', async () => {
const [src, out] = await getFiles('attribute-with-embedded-expr');
assert.not.fixture(src, out);
const formatted = format(src);
assert.fixture(formatted, out);
});
Prettier.run();

View file

@ -0,0 +1,6 @@
---
export let post
export let author
---
<a class="author" href={`/author/${post.author}`}>{author.name}</a>

View file

@ -0,0 +1,6 @@
---
export let post;
export let author;
---
<a class="author" href={`/author/${post.author}`}>{author.name}</a>