summaryrefslogtreecommitdiffstats
path: root/browser/components/translations/tests/browser/browser_translations_select_panel_pdf.js
blob: fd675e9cea5f3d43809badb9fcf3290cc7a33fda (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
32
33
34
35
36
37
38
39
40
41
42
/* Any copyright is dedicated to the Public Domain.
   https://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * This test case verifies that the Select Translations Panel functionality
 * is available and works within PDF files.
 */
add_task(async function test_the_select_translations_panel_in_pdf_files() {
  const { cleanup, runInPage, resolveDownloads } = await loadTestPage({
    page: PDF_TEST_PAGE_URL,
    languagePairs: LANGUAGE_PAIRS,
    prefs: [["browser.translations.select.enable", true]],
  });

  await SelectTranslationsTestUtils.openPanel(runInPage, {
    selectPdfSpan: true,
    openAtPdfSpan: true,
    expectedFromLanguage: "en",
    expectedToLanguage: "en",
    onOpenPanel: SelectTranslationsTestUtils.assertPanelViewTranslated,
  });

  await SelectTranslationsTestUtils.changeSelectedFromLanguage(["es"], {
    openDropdownMenu: true,
    pivotTranslation: false,
    downloadHandler: resolveDownloads,
    onChangeLanguage: SelectTranslationsTestUtils.assertPanelViewTranslated,
  });

  await SelectTranslationsTestUtils.changeSelectedToLanguage(["fr"], {
    openDropdownMenu: false,
    pivotTranslation: true,
    downloadHandler: resolveDownloads,
    onChangeLanguage: SelectTranslationsTestUtils.assertPanelViewTranslated,
  });

  await SelectTranslationsTestUtils.clickDoneButton();

  await cleanup();
});