diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editor/libeditor/tests/test_initial_selection_and_caret_of_designMode.html')
-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> |