Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Jul 21, 2023
1 parent 274e675 commit c65da5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions packages/astro/components/ViewTransitions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/astro/e2e/view-transitions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit c65da5f

Please sign in to comment.