[ci] format
This commit is contained in:
parent
d59e511d16
commit
7f8ccbe876
2 changed files with 7 additions and 8 deletions
|
@ -24,13 +24,12 @@ test.describe('Vue components in MDX files', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('test the async vue component in astro', async ({ page, astro }) => {
|
test('test the async vue component in astro', async ({ page, astro }) => {
|
||||||
await page.goto(astro.resolveUrl('/'));
|
await page.goto(astro.resolveUrl('/'));
|
||||||
|
|
||||||
const label = page.locator('#client-test');
|
const label = page.locator('#client-test');
|
||||||
|
|
||||||
await expect(label, 'component not hydrated').toHaveText('2');
|
await expect(label, 'component not hydrated').toHaveText('2');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('test the async vue component in mdx', async ({ page, astro }) => {
|
test('test the async vue component in mdx', async ({ page, astro }) => {
|
||||||
|
|
|
@ -18,9 +18,9 @@ export default (element) =>
|
||||||
// related to https://github.com/withastro/astro/issues/6549
|
// related to https://github.com/withastro/astro/issues/6549
|
||||||
// if the component is async, wrap it in a Suspense component
|
// if the component is async, wrap it in a Suspense component
|
||||||
if (isAsync(Component.setup)) {
|
if (isAsync(Component.setup)) {
|
||||||
content = h(Suspense, null, content)
|
content = h(Suspense, null, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client === 'only') {
|
if (client === 'only') {
|
||||||
const app = createApp({ name, render: () => content });
|
const app = createApp({ name, render: () => content });
|
||||||
await setup(app);
|
await setup(app);
|
||||||
|
@ -32,7 +32,7 @@ export default (element) =>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function isAsync (fn) {
|
function isAsync(fn) {
|
||||||
const constructor = fn?.constructor
|
const constructor = fn?.constructor;
|
||||||
return constructor && constructor.name === 'AsyncFunction';
|
return constructor && constructor.name === 'AsyncFunction';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue