[ci] format
This commit is contained in:
parent
274e675328
commit
c65da5f1cd
2 changed files with 12 additions and 9 deletions
|
@ -48,12 +48,15 @@ const { fallback = 'animate' } = Astro.props as Props;
|
||||||
const swap = () => document.documentElement.replaceWith(doc.documentElement);
|
const swap = () => document.documentElement.replaceWith(doc.documentElement);
|
||||||
|
|
||||||
// Wait on links to finish, to prevent FOUC
|
// Wait on links to finish, to prevent FOUC
|
||||||
const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(link => new Promise(resolve => {
|
const links = Array.from(doc.querySelectorAll('head link[rel=stylesheet]')).map(
|
||||||
const c = link.cloneNode();
|
(link) =>
|
||||||
['load', 'error'].forEach(evName => c.addEventListener(evName, resolve));
|
new Promise((resolve) => {
|
||||||
document.head.append(c);
|
const c = link.cloneNode();
|
||||||
}));
|
['load', 'error'].forEach((evName) => c.addEventListener(evName, resolve));
|
||||||
if(links.length) {
|
document.head.append(c);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
if (links.length) {
|
||||||
await Promise.all(links);
|
await Promise.all(links);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,9 +128,9 @@ test.describe('View Transitions', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Stylesheets in the head are waited on', async ({ page, astro }) => {
|
test('Stylesheets in the head are waited on', async ({ page, astro }) => {
|
||||||
page.addListener('console', data => {
|
page.addListener('console', (data) => {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
})
|
});
|
||||||
|
|
||||||
// Go to page 1
|
// Go to page 1
|
||||||
await page.goto(astro.resolveUrl('/one'));
|
await page.goto(astro.resolveUrl('/one'));
|
||||||
|
|
Loading…
Reference in a new issue