From fb7bfc2748c4d84a3f7ad602dd6a4768a50014a9 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Thu, 18 Jan 2024 13:21:38 -0500 Subject: [PATCH] Fix image widths --- src/common/ProgressiveImage.svelte | 2 +- src/config/config.js | 8 +++++++- tests/anonymous/manager/app.spec.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/ProgressiveImage.svelte b/src/common/ProgressiveImage.svelte index 0ecd3ea30..ef94070de 100644 --- a/src/common/ProgressiveImage.svelte +++ b/src/common/ProgressiveImage.svelte @@ -23,7 +23,7 @@ let largestLoaded = -1; const NORMAL_WIDTH = IMAGE_WIDTHS.map((x, i) => [x, i]).filter( - (x) => x[1][0] == "normal", + (x) => x[0][1] == "normal", )[0]; let mounted = false; diff --git a/src/config/config.js b/src/config/config.js index 75afd6d65..f8aa8dccd 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -33,7 +33,8 @@ export const DC_LOGOUT = "/accounts/logout/"; export const SQUARELET_SIGNUP = "/accounts/signup/?intent=documentcloud&next="; export const POLL_INTERVAL = 5000; -export const IMAGE_WIDTHS = [ + +export const IMAGE_WIDTHS_ENTRIES = [ ["xlarge", 2000], ["large", 1000], ["normal", 700], @@ -41,6 +42,11 @@ export const IMAGE_WIDTHS = [ ["thumbnail", 60], ]; +export const IMAGE_WIDTHS = IMAGE_WIDTHS_ENTRIES.map(([name, width]) => [ + width, + name, +]); + export const IMAGE_WIDTHS_MAP = new Map(IMAGE_WIDTHS); export const MAX_PER_PAGE = 100; diff --git a/tests/anonymous/manager/app.spec.js b/tests/anonymous/manager/app.spec.js index 5b338d954..44469607a 100644 --- a/tests/anonymous/manager/app.spec.js +++ b/tests/anonymous/manager/app.spec.js @@ -19,7 +19,7 @@ test.describe("manager tests", () => { ).toBeVisible(); // close the overlay - await page.getByRole("button").nth(3).click(); + await page.locator("button.dismiss").click(); // can we see documents? await expect(page.locator(".outer > div").first()).toBeVisible();