summaryrefslogtreecommitdiffstats
path: root/toolkit/components/translations/tests/browser/browser_translations_pdf_is_disabled.js
blob: 902a5ad2484bafe46616a06ab83fb64ad3a3a7ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Tests that the translations button becomes disabled when entering pdf.
 */
add_task(async function test_translations_button_disabled_in_pdf() {
  const { cleanup } = await loadTestPage({
    page: PDF_TEST_PAGE_URL,
  });

  const appMenuButton = document.getElementById("PanelUI-menu-button");

  click(appMenuButton, "Opening the app menu");
  await BrowserTestUtils.waitForEvent(window.PanelUI.mainView, "ViewShown");

  const translateSiteButton = document.getElementById(
    "appMenu-translate-button"
  );
  is(
    translateSiteButton.disabled,
    true,
    "The app-menu translate button should be disabled because PDFs are restricted"
  );

  click(appMenuButton, "Closing the app menu");

  await cleanup();
});