diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html b/editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html new file mode 100644 index 0000000000..5c08370321 --- /dev/null +++ b/editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html @@ -0,0 +1,57 @@ +<!doctype html> +<head> + <title>Test for initial selection and caret at turning on the designMode with user interaction</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" href="/tests/SimpleTest/test.css"> +</head> +<p>foo</p> +<button onclick="document.designMode = 'on'">click</button> +<script> +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(() => { + synthesizeMouseAtCenter(document.querySelector("button"), {}); + + is( + document.activeElement, + document.body, + "The <body> element should be active" + ); + is( + getSelection().focusNode, + document.body.firstChild.firstChild, + "The focus node should be the text node in the first paragraph" + ); + is( + getSelection().anchorNode, + document.body.firstChild.firstChild, + "The anchor node should be the text node in the first paragraph" + ); + is( + getSelection().focusOffset, + 0, + "The focus offset should be 0" + ); + is( + getSelection().anchorOffset, + 0, + "The anchor offset should be 0" + ); + + function getHTMLEditor() { + return SpecialPowers.wrap(window).docShell.editingSession?.getEditorForWindow(window); + } + ok( + getHTMLEditor().selectionController.getCaretEnabled(), + "The caret should be enabled" + ); + ok( + getHTMLEditor().selectionController.caretVisible, + "The caret should be visible" + ); + + document.designMode = "off"; + + SimpleTest.finish(); +}); +</script> |