mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibWeb: Add datalist element options property
This commit is contained in:
committed by
Andreas Kling
parent
90fcfca6f6
commit
3e507102ea
Notes:
sideshowbarker
2024-07-17 07:09:53 +09:00
Author: https://github.com/bplaat Commit: https://github.com/SerenityOS/serenity/commit/3e507102ea Pull-request: https://github.com/SerenityOS/serenity/pull/23902
35
Tests/LibWeb/Text/input/HTML/datalist-element.html
Normal file
35
Tests/LibWeb/Text/input/HTML/datalist-element.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let testCounter = 1;
|
||||
function testPart(part) {
|
||||
println(`${testCounter++}. ${JSON.stringify(part())}`);
|
||||
}
|
||||
|
||||
// 1. Get options from datalist
|
||||
testPart(() => {
|
||||
const datalist = document.createElement('datalist');
|
||||
for (let i = 0; i < 10; i++) {
|
||||
datalist.appendChild(document.createElement('div'));
|
||||
}
|
||||
for (let i = 0; i < 10; i++) {
|
||||
datalist.appendChild(document.createElement('option'));
|
||||
}
|
||||
return datalist.options.length;
|
||||
});
|
||||
|
||||
// 2. Check if options is same object and live
|
||||
testPart(() => {
|
||||
const datalist = document.createElement('datalist');
|
||||
for (let i = 0; i < 10; i++) {
|
||||
datalist.appendChild(document.createElement('option'));
|
||||
}
|
||||
for (let i = 0; i < 10; i++) {
|
||||
datalist.appendChild(document.createElement('div'));
|
||||
}
|
||||
const options = datalist.options;
|
||||
datalist.appendChild(document.createElement('option'));
|
||||
return options.length;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user