mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Add test for document.execCommand("delete")
Anchor the minimum functionality for this. WPT has an extensive suite to test editing functionalities, but they all take a long time to execute - so let's have a simple regression test in-tree for now.
This commit is contained in:
committed by
Andreas Kling
parent
4b0d8cbfad
commit
033cd9cab3
Notes:
github-actions[bot]
2024-11-30 16:36:51 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/033cd9cab33 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2655 Reviewed-by: https://github.com/shannonbooth Reviewed-by: https://github.com/yyny
18
Tests/LibWeb/Text/input/Editing/execCommand-delete.html
Normal file
18
Tests/LibWeb/Text/input/Editing/execCommand-delete.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">foobar</div>
|
||||
<script>
|
||||
test(() => {
|
||||
var divElm = document.querySelector('div');
|
||||
println(`Before: ${divElm.textContent}`);
|
||||
|
||||
// Put cursor after 'foo'
|
||||
var range = document.createRange();
|
||||
range.setStart(divElm.childNodes[0], 3);
|
||||
getSelection().addRange(range);
|
||||
|
||||
// Press backspace
|
||||
document.execCommand('delete');
|
||||
|
||||
println(`After: ${divElm.textContent}`);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user