Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(web): make the favicon picker offscreen-preview test deterministic #22174

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/22174/headmerged by juliusmarminge View on GitHub

Showing 1 changed file with 7 additions and 2 deletions.

x
0 of 1 viewed, 1 left
7 additions and 2 deletionsapps/web/src/components/settings/ProjectFaviconPickerDialog.browser.test.tsxModified
View file
@@ -166,9 +166,14 @@
});
​
+// Decoding sets naturalWidth before the load event reaches React, so wait for both together.
async function expectPreview(row: HTMLElement) {
- await expect.poll(() => row.querySelector("img")?.naturalWidth).toBe(8);
- expect(row.querySelector("svg")).toBeNull();
+ await expect
+ .poll(() => ({
+ width: row.querySelector("img")?.naturalWidth,
+ fallback: row.querySelector("svg") !== null,
+ }))
+ .toEqual({ width: 8, fallback: false });
​
it("loads previews asynchronously and only acquires offscreen images after scrolling", async () => {