mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:47:35 +00:00
LibWeb: Begin implementing the Clipboard API
https://w3c.github.io/clipboard-apis/ This implements enough for navigator.clipboard.writeText(String).
This commit is contained in:
parent
78d455e231
commit
4b94b0b561
14 changed files with 303 additions and 0 deletions
26
Tests/LibWeb/Text/input/clipboard.html
Normal file
26
Tests/LibWeb/Text/input/clipboard.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<button id="button"></button>
|
||||
<script src="include.js"></script>
|
||||
<script type="text/javascript">
|
||||
function writeText(onComplete) {
|
||||
navigator.clipboard.writeText("Well hello friends :^)").then(
|
||||
() => {
|
||||
println("Success");
|
||||
onComplete();
|
||||
},
|
||||
() => {
|
||||
println("Failure");
|
||||
onComplete();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
asyncTest((done) => {
|
||||
writeText(() => {
|
||||
const button = document.getElementById("button");
|
||||
internals.dispatchUserActivatedEvent(button, new Event("mousedown"));
|
||||
button.dispatchEvent(new Event("click"));
|
||||
|
||||
writeText(done);
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue