Merge pull request #18779 from calixteman/bug1920515
[Editor] Don't show the ml toggle button when the ml is disabled (bug 1920515)
This commit is contained in:
commit
c90ce5da20
@ -1122,6 +1122,74 @@ describe("Stamp Editor", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("New alt-text flow (bug 1920515)", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait(
|
||||||
|
"empty.pdf",
|
||||||
|
".annotationEditorLayer",
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
eventBusSetup: eventBus => {
|
||||||
|
eventBus.on("annotationeditoruimanager", ({ uiManager }) => {
|
||||||
|
window.uiManager = uiManager;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
enableAltText: false,
|
||||||
|
enableFakeMLManager: false,
|
||||||
|
enableUpdatedAddImage: true,
|
||||||
|
enableGuessAltText: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
for (const [, page] of pages) {
|
||||||
|
if (await isVisible(page, "#newAltTextDialog")) {
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
|
await page.waitForSelector("#newAltTextDisclaimer", {
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await page.evaluate(() => {
|
||||||
|
window.uiManager.reset();
|
||||||
|
});
|
||||||
|
// Disable editing mode.
|
||||||
|
await switchToStamp(page, /* disable */ true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the toggle button isn't displayed when there is no AI", async () => {
|
||||||
|
// Run sequentially to avoid clipboard issues.
|
||||||
|
for (const [, page] of pages) {
|
||||||
|
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.noAi", { visible: true });
|
||||||
|
|
||||||
|
// enableFakeMLManager is false, so it means that we don't have ML but
|
||||||
|
// we're using the new flow, hence we don't want to have the toggle
|
||||||
|
// button.
|
||||||
|
await page.waitForSelector("#newAltTextCreateAutomatically", {
|
||||||
|
hidden: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("No auto-resize", () => {
|
describe("No auto-resize", () => {
|
||||||
let pages;
|
let pages;
|
||||||
|
|
||||||
|
|||||||
@ -350,6 +350,7 @@ const PDFViewerApplication = {
|
|||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
|
||||||
Object.assign(opts, {
|
Object.assign(opts, {
|
||||||
enableAltText: x => x === "true",
|
enableAltText: x => x === "true",
|
||||||
|
enableFakeMLManager: x => x === "true",
|
||||||
enableGuessAltText: x => x === "true",
|
enableGuessAltText: x => x === "true",
|
||||||
enableUpdatedAddImage: x => x === "true",
|
enableUpdatedAddImage: x => x === "true",
|
||||||
highlightEditorColors: x => x,
|
highlightEditorColors: x => x,
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class NewAltTextManager {
|
|||||||
|
|
||||||
#guessedAltText;
|
#guessedAltText;
|
||||||
|
|
||||||
#hasAI = false;
|
#hasAI = null;
|
||||||
|
|
||||||
#isEditing = null;
|
#isEditing = null;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user