mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00: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:
parent
4b0d8cbfad
commit
033cd9cab3
Notes:
github-actions[bot]
2024-11-30 16:36:51 +00:00
Author: https://github.com/gmta
Commit: 033cd9cab3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2655
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/yyny
2 changed files with 20 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Before: foobar
|
||||
After: fobar
|
||||
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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue