1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:27:35 +00:00

LibWeb: Add textarea value properties

This commit is contained in:
Bastiaan van der Plaat 2023-12-10 17:48:42 +01:00 committed by Andreas Kling
parent e33ae9a58b
commit 091faf1aae
5 changed files with 105 additions and 9 deletions

View file

@ -0,0 +1,4 @@
1. "PASS"
2. "PASS"
3. "PASS"
4. 4

View file

@ -0,0 +1,39 @@
<script src="include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
println(`${testCounter++}. ${JSON.stringify(part())}`);
}
// 1. Textarea get value
testPart(() => {
const textarea = document.createElement('textarea');
textarea.textContent = 'PASS';
return textarea.value;
});
// 2. Textarea set value
testPart(() => {
const textarea = document.createElement('textarea');
textarea.textContent = 'PASS';
textarea.value = 'FAIL';
return textarea.textContent;
});
// 3. Textarea set default value
testPart(() => {
const textarea = document.createElement('textarea');
textarea.textContent = 'FAIL';
textarea.defaultValue = 'PASS';
return textarea.textContent;
});
// 4. Textarea text length
testPart(() => {
const textarea = document.createElement('textarea');
textarea.innerHTML = 'PASS';
return textarea.textLength;
});
});
</script>