mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
LibWeb: Implement “suffering from a step mismatch” constraint validation
This commit is contained in:
parent
12f5e9c5f8
commit
d14856e3c5
|
|
@ -3098,10 +3098,20 @@ bool HTMLInputElement::suffering_from_an_overflow() const
|
|||
// https://html.spec.whatwg.org/multipage/input.html#the-step-attribute%3Asuffering-from-a-step-mismatch
|
||||
bool HTMLInputElement::suffering_from_a_step_mismatch() const
|
||||
{
|
||||
// When the element has an allowed value step, and the result of applying the algorithm to convert a string to a number to the string given by the element's
|
||||
// value is a number, and that number subtracted from the step base is not an integral multiple of the allowed value step, the element is suffering from a step mismatch.
|
||||
// FIXME: Implement this.
|
||||
// When the element has an allowed value step,
|
||||
auto maybe_allowed_value_step = allowed_value_step();
|
||||
if (!maybe_allowed_value_step.has_value())
|
||||
return false;
|
||||
double allowed_value_step = *maybe_allowed_value_step;
|
||||
// and the result of applying the algorithm to convert a string to a number to the string given by the element's
|
||||
// value is a number,
|
||||
auto maybe_number = convert_string_to_number(value());
|
||||
if (!maybe_number.has_value())
|
||||
return false;
|
||||
double number = maybe_number.value();
|
||||
// and that number subtracted from the step base is not an integral multiple of the allowed value step, the element
|
||||
// is suffering from a step mismatch.
|
||||
return fmod(step_base() - number, allowed_value_step) != 0;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#suffering-from-bad-input
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
|||
|
||||
Found 130 tests
|
||||
|
||||
90 Pass
|
||||
40 Fail
|
||||
108 Pass
|
||||
22 Fail
|
||||
Pass [INPUT in TEXT status] no constraint
|
||||
Pass [INPUT in TEXT status] no constraint (in a form)
|
||||
Pass [INPUT in TEXT status] not suffering from being too long
|
||||
|
|
@ -68,32 +68,32 @@ Pass [INPUT in DATETIME-LOCAL status] suffering from being missing
|
|||
Pass [INPUT in DATETIME-LOCAL status] suffering from being missing (in a form)
|
||||
Pass [INPUT in DATE status] no constraint
|
||||
Pass [INPUT in DATE status] no constraint (in a form)
|
||||
Fail [INPUT in DATE status] suffering from an overflow
|
||||
Fail [INPUT in DATE status] suffering from an overflow (in a form)
|
||||
Fail [INPUT in DATE status] suffering from an underflow
|
||||
Fail [INPUT in DATE status] suffering from an underflow (in a form)
|
||||
Fail [INPUT in DATE status] suffering from a step mismatch
|
||||
Fail [INPUT in DATE status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in DATE status] suffering from an overflow
|
||||
Pass [INPUT in DATE status] suffering from an overflow (in a form)
|
||||
Pass [INPUT in DATE status] suffering from an underflow
|
||||
Pass [INPUT in DATE status] suffering from an underflow (in a form)
|
||||
Pass [INPUT in DATE status] suffering from a step mismatch
|
||||
Pass [INPUT in DATE status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in DATE status] suffering from being missing
|
||||
Pass [INPUT in DATE status] suffering from being missing (in a form)
|
||||
Pass [INPUT in MONTH status] no constraint
|
||||
Pass [INPUT in MONTH status] no constraint (in a form)
|
||||
Fail [INPUT in MONTH status] suffering from an overflow
|
||||
Fail [INPUT in MONTH status] suffering from an overflow (in a form)
|
||||
Fail [INPUT in MONTH status] suffering from an underflow
|
||||
Fail [INPUT in MONTH status] suffering from an underflow (in a form)
|
||||
Fail [INPUT in MONTH status] suffering from a step mismatch
|
||||
Fail [INPUT in MONTH status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in MONTH status] suffering from an overflow
|
||||
Pass [INPUT in MONTH status] suffering from an overflow (in a form)
|
||||
Pass [INPUT in MONTH status] suffering from an underflow
|
||||
Pass [INPUT in MONTH status] suffering from an underflow (in a form)
|
||||
Pass [INPUT in MONTH status] suffering from a step mismatch
|
||||
Pass [INPUT in MONTH status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in MONTH status] suffering from being missing
|
||||
Pass [INPUT in MONTH status] suffering from being missing (in a form)
|
||||
Pass [INPUT in WEEK status] no constraint
|
||||
Pass [INPUT in WEEK status] no constraint (in a form)
|
||||
Fail [INPUT in WEEK status] suffering from an overflow
|
||||
Fail [INPUT in WEEK status] suffering from an overflow (in a form)
|
||||
Fail [INPUT in WEEK status] suffering from an underflow
|
||||
Fail [INPUT in WEEK status] suffering from an underflow (in a form)
|
||||
Fail [INPUT in WEEK status] suffering from a step mismatch
|
||||
Fail [INPUT in WEEK status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in WEEK status] suffering from an overflow
|
||||
Pass [INPUT in WEEK status] suffering from an overflow (in a form)
|
||||
Pass [INPUT in WEEK status] suffering from an underflow
|
||||
Pass [INPUT in WEEK status] suffering from an underflow (in a form)
|
||||
Pass [INPUT in WEEK status] suffering from a step mismatch
|
||||
Pass [INPUT in WEEK status] suffering from a step mismatch (in a form)
|
||||
Pass [INPUT in WEEK status] suffering from being missing
|
||||
Pass [INPUT in WEEK status] suffering from being missing (in a form)
|
||||
Pass [INPUT in TIME status] no constraint
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user