summaryrefslogtreecommitdiffstats
path: root/browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js')
-rw-r--r--browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js b/browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js
new file mode 100644
index 0000000000..82e5d3ba63
--- /dev/null
+++ b/browser/components/translations/tests/browser/browser_translations_select_context_menu_with_no_text_selected.js
@@ -0,0 +1,37 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/**
+ * This test case verifies that the translate-selection context menu item is unavailable
+ * when no text is selected.
+ */
+add_task(
+ async function test_translate_selection_menuitem_is_unavailable_when_no_text_is_selected() {
+ const { cleanup, runInPage } = await loadTestPage({
+ page: SPANISH_PAGE_URL,
+ languagePairs: LANGUAGE_PAIRS,
+ prefs: [["browser.translations.select.enable", true]],
+ });
+
+ await FullPageTranslationsTestUtils.assertTranslationsButton(
+ { button: true, circleArrows: false, locale: false, icon: true },
+ "The button is available."
+ );
+
+ await FullPageTranslationsTestUtils.assertPageIsUntranslated(runInPage);
+
+ await SelectTranslationsTestUtils.assertContextMenuTranslateSelectionItem(
+ runInPage,
+ {
+ selectSpanishParagraph: false,
+ openAtSpanishParagraph: true,
+ expectMenuItemVisible: false,
+ },
+ "The translate-selection context menu item should be unavailable when no text is selected."
+ );
+
+ await cleanup();
+ }
+);