Skip to content

Commit

Permalink
Merge pull request #18719 from calixteman/bug1917543
Browse files Browse the repository at this point in the history
[Editor] Avoid to have the ML disclaimer when the ML engine isn't ready (bug 1917543)
  • Loading branch information
calixteman committed Sep 9, 2024
2 parents 95cd848 + 6e4b7ee commit f98e604
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,5 +1096,28 @@ describe("Stamp Editor", () => {
await page.waitForSelector("#newAltTextDialog", { visible: false });
}
});

it("must check the new alt text flow (part 3)", async () => {
// Run sequentially to avoid clipboard issues.
for (const [, page] of pages) {
await page.evaluate(() => {
window.PDFViewerApplication.mlManager.enableAltTextModelDownload = false;
});

await switchToStamp(page);

// Add an image.
await copyImage(page, "../images/firefox_logo.png", 0);
const editorSelector = getEditorSelector(0);
await page.waitForSelector(editorSelector);
await waitForSerialized(page, 1);

// Wait for the dialog to be visible.
await page.waitForSelector("#newAltTextDialog", { visible: true });

// Check we haven't the disclaimer.
await page.waitForSelector("#newAltTextDisclaimer[hidden]");
}
});
});
});
1 change: 1 addition & 0 deletions web/new_alt_text_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class NewAltTextManager {
this.#firstTime = firstTime;
let { mlManager } = uiManager;
let hasAI = !!mlManager;
this.#toggleTitleAndDisclaimer();

if (mlManager && !mlManager.isReady("altText")) {
hasAI = false;
Expand Down

0 comments on commit f98e604

Please sign in to comment.