Tests/LibWeb: Verify dialog return value is correct in dialog test

This commit is contained in:
Tim Ledbetter 2024-02-15 18:29:53 +00:00 committed by Tim Flynn
parent 88fe236c77
commit f5266e0096
Notes: sideshowbarker 2024-07-17 21:26:19 +09:00
2 changed files with 6 additions and 3 deletions

View file

@ -1,2 +1,4 @@
dialog.open before form submit: true
dialog.returnValue before form submit should be empty: true
dialog.open after form submit: false
dialog.returnValue after form submit: PASS

View file

@ -1,7 +1,7 @@
<script src="./include.js"></script>
<dialog id="test-dialog" open>
<form method="dialog">
<button id="submit-button">Submit</button>
<button id="submit-button" value="PASS">Submit</button>
</form>
</dialog>
<script>
@ -10,8 +10,9 @@
const submitter = document.getElementById("submit-button");
const form = document.forms[0];
println(`dialog.open before form submit: ${dialog.open}`);
form.submit();
println(`dialog.returnValue before form submit should be empty: ${dialog.returnValue === ""}`);
form.requestSubmit(submitter);
println(`dialog.open after form submit: ${dialog.open}`);
println(`dialog.returnValue after form submit: ${dialog.returnValue}`);
});
</script>