0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] format

This commit is contained in:
matthewp 2023-07-21 20:29:15 +00:00 committed by astrobot-houston
parent 274e675328
commit c65da5f1cd
2 changed files with 12 additions and 9 deletions

View file

@ -48,12 +48,15 @@ const { fallback = 'animate' } = Astro.props as Props;
const swap = () => document.documentElement.replaceWith(doc.documentElement);
// Wait on links to finish, to prevent FOUC
const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(link => new Promise(resolve => {
const c = link.cloneNode();
['load', 'error'].forEach(evName => c.addEventListener(evName, resolve));
document.head.append(c);
}));
if(links.length) {
const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(
(link) =>
new Promise((resolve) => {
const c = link.cloneNode();
['load', 'error'].forEach((evName) => c.addEventListener(evName, resolve));
document.head.append(c);
})
);
if (links.length) {
await Promise.all(links);
}

View file

@ -128,9 +128,9 @@ test.describe('View Transitions', () => {
});
test('Stylesheets in the head are waited on', async ({ page, astro }) => {
page.addListener('console', data => {
console.log(data)
})
page.addListener('console', (data) => {
console.log(data);
});
// Go to page 1
await page.goto(astro.resolveUrl('/one'));