Skip to content

Commit

Permalink
Remove outer font listener in regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
mj12albert committed Dec 18, 2024
1 parent e0dd086 commit d721946
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
6 changes: 0 additions & 6 deletions test/regressions/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ await page.route(/./, async (route, request) => {
// This should load shared resources such as fonts.
await page.goto(`${baseUrl}#no-dev`, { waitUntil: 'networkidle' });

const fontActive = page.locator('[data-font-state="active"]');
await fontActive.waitFor({
state: 'hidden',
timeout: 5000,
});

// Simulate portrait mode for date pickers.
// See `useIsLandscape`.
await page.evaluate(() => {
Expand Down
20 changes: 0 additions & 20 deletions test/regressions/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,6 @@ function App(props: { fixtures: Fixture[] }) {
};
}, []);

const [fontState, setFontState] = React.useState<'active' | 'pending' | 'error'>('pending');

React.useEffect(function registerFontListeners() {
function handleLoadingDone() {
setFontState('active');
}

function handleLoadingError() {
setFontState('error');
}

document.fonts.addEventListener('loadingdone', handleLoadingDone);
document.fonts.addEventListener('loadingerror', handleLoadingError);
return () => {
document.fonts.removeEventListener('loadingdone', handleLoadingDone);
document.fonts.removeEventListener('loadingerror', handleLoadingError);
};
}, []);

function computePath(fixture: Fixture) {
return `/${fixture.suite}/${fixture.name}`;
}
Expand Down Expand Up @@ -211,7 +192,6 @@ function App(props: { fixtures: Fixture[] }) {
</Routes>

<div hidden={!isDev}>
<div data-font-state={fontState}>font-state: {fontState}</div>
<p>
Devtools can be enabled by appending <code>#dev</code> in the addressbar or disabled by
appending <code>#no-dev</code>.
Expand Down

0 comments on commit d721946

Please sign in to comment.