mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #24626 - glowe:issue-21810/improve-validation-methods, r=jdm
Issue 21810/improve validation methods <!-- Please describe your changes on the following line: --> This is a start at addressing #21810. I'm putting these changes out early to get some feedback on the following items: 1. I added unit tests for the validation methods mentioned in #21810, because I couldn't tell whether any of the existing WPT tests covered them. Are these tests worthwhile? Are any of them unnecessary? 2. I changed the implementation for `is_valid_floating_point_number_string` so that it passed the tests. The previous version of the function wasn't restrictive enough (it allowed certain whitespace characters before the number string). 3. I changed the catch-all condition in `htmlinputelement.rs` to account for the remaining input types that don't have a value sanitization algorithm. This last change seems good to me since we won't be able to add a new input type without adding it to the case and checking the spec for an algorithm. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21810 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
7ba88e8237
4 changed files with 21 additions and 8 deletions
|
@ -35,7 +35,11 @@
|
|||
{value: "+1", expected: "", testname: "value = +1"},
|
||||
{value: "+", expected: "", testname: "value = '+'"},
|
||||
{value: "-", expected: "", testname: "value = '-'"},
|
||||
{value: " 1", expected: "", testname: "value with a leading whitespace"},
|
||||
{value: "\t1", expected: "", testname: "value with a leading tab"},
|
||||
{value: "\n1", expected: "", testname: "value with a leading newline"},
|
||||
{value: "\f1", expected: "", testname: "value with a leading form feed"},
|
||||
{value: "\r1", expected: "", testname: "value with a leading carriage return"},
|
||||
{value: " 1", expected: "", testname: "value with a leading space"},
|
||||
{value: "1trailing junk", expected: "", testname: "value = 1trailing junk"}
|
||||
];
|
||||
for (var i = 0; i < numbers.length; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue