ladybird/Tests/LibWeb/Text/input/input-bad-input-validity.html
Tim Ledbetter de0b733bed LibWeb: Implement suffering from bad input for input elements
Email field support is left unimplemented because we don't have a way
to convert email addresses to punycode.
2026-06-08 19:28:37 +02:00

27 lines
910 B
HTML

<!DOCTYPE html>
<script src="include.js"></script>
<script>
test(() => {
function check(type, text) {
const input = document.body.appendChild(document.createElement("input"));
input.type = type;
input.focus();
internals.sendText(input, text);
println(`${type} "${text}": value="${input.value}" badInput=${input.validity.badInput}`);
input.remove();
}
check("number", "2026");
check("number", "2026 JUN");
check("date", "2026-06-08");
check("date", "2026-99-99");
check("month", "2026-06");
check("month", "2026-13");
check("week", "2026-W23");
check("week", "2026-W99");
check("time", "12:30");
check("time", "25:99");
check("datetime-local", "2026-06-08T12:30");
check("datetime-local", "not a date");
});
</script>