mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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…
Reference in New Issue
Block a user