mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
LibWeb: Implement value attribute of RadioNodeList
This commit is contained in:
parent
708263790a
commit
f115e44066
5 changed files with 180 additions and 1 deletions
52
Tests/LibWeb/Text/input/radio-node-list.html
Normal file
52
Tests/LibWeb/Text/input/radio-node-list.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<form>
|
||||
<input value="value1" id="non-checked-with-value" type="radio"/>
|
||||
<input value="value2" id="non-checked-with-value" type="radio"/>
|
||||
<input value="value3" id="checked-with-value" type="radio" checked/>
|
||||
<input value="value4" id="checked-with-value" type="radio" checked/>
|
||||
<input value="on" id="non-checked-value-on" type="radio"/>
|
||||
<input value="on" id="non-checked-value-on" type="radio"/>
|
||||
<input value="value1" id="no-radio-button" type="input" checked/>
|
||||
<input value="value2" id="no-radio-button" type="input" checked/>
|
||||
<input id="checked-no-value" type="radio" checked/>
|
||||
<input id="checked-no-value" type="radio" checked/>
|
||||
<input id="non-checked-no-value" type="radio"/>
|
||||
<input id="non-checked-no-value" type="radio"/>
|
||||
</form>
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const formElements = document.forms[0].elements;
|
||||
|
||||
function dumpAttributes(name) {
|
||||
println("===================");
|
||||
println(name);
|
||||
println("===================");
|
||||
const list = formElements.namedItem(name);
|
||||
println(list.length);
|
||||
println(list[0].value);
|
||||
println(list[1].value);
|
||||
println(`value = '${list.value}'`);
|
||||
list.value = "on";
|
||||
println(`value = '${list.value}'`);
|
||||
}
|
||||
|
||||
function setValue(name, value) {
|
||||
println("===================");
|
||||
println(name);
|
||||
println("===================");
|
||||
const list = formElements.namedItem(name);
|
||||
println(`value = ${list.value}`);
|
||||
list.value = value;
|
||||
println(`value = ${list.value}`);
|
||||
}
|
||||
|
||||
dumpAttributes("non-checked-with-value");
|
||||
dumpAttributes("checked-with-value");
|
||||
dumpAttributes("checked-no-value");
|
||||
dumpAttributes("no-radio-button");
|
||||
|
||||
setValue("non-checked-with-value", "value1")
|
||||
setValue("non-checked-no-value", "on")
|
||||
setValue("non-checked-value-on", "on")
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue