Closed Bug 829101 Opened 10 years ago Closed 10 years ago

Update tests for <input type='{email,number}'> value sanitization tests

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(1 file)

No description provided.
Attached patch PatchSplinter Review
Happier? :)
Attachment #700528 - Flags: review?(Ms2ger)
Summary: Update tests (and maybe code) for <input type='{email,number}'> value sanitization tests → Update tests for <input type='{email,number}'> value sanitization tests
Comment on attachment 700528 [details] [diff] [review]
Patch

Review of attachment 700528 [details] [diff] [review]:
-----------------------------------------------------------------

r=me, thanks.

::: content/html/content/test/forms/test_input_sanitization.html
@@ +51,5 @@
>      case "tel":
>        return aValue.replace(/[\n\r]/g, "");
>      case "url":
>      case "email":
> +      return aValue.replace(/[\n\r]/g, "").replace(/^[\u0020\u0009\t\u000a\u000c\u000d]+|[\u0020\u0009\t\u000a\u000c\u000d]+$/g, "");

\t === \u0009, no?

@@ +56,3 @@
>      case "number":
> +      var number = Number(aValue);
> +      return number === number ? aValue : "";

!isNaN(Number(aValue)), maybe?
Attachment #700528 - Flags: review?(Ms2ger) → review+
(In reply to :Ms2ger from comment #2)
> ::: content/html/content/test/forms/test_input_sanitization.html
> @@ +51,5 @@
> >      case "tel":
> >        return aValue.replace(/[\n\r]/g, "");
> >      case "url":
> >      case "email":
> > +      return aValue.replace(/[\n\r]/g, "").replace(/^[\u0020\u0009\t\u000a\u000c\u000d]+|[\u0020\u0009\t\u000a\u000c\u000d]+$/g, "");
> 
> \t === \u0009, no?

Yes. And \u0020 is " ". Just want to keep the unicode values for all the characters.

> @@ +56,3 @@
> >      case "number":
> > +      var number = Number(aValue);
> > +      return number === number ? aValue : "";
> 
> !isNaN(Number(aValue)), maybe?

Maybe, indeed.
https://hg.mozilla.org/integration/mozilla-inbound/rev/8164852113cd
Flags: in-testsuite+
Target Milestone: --- → mozilla21
https://hg.mozilla.org/mozilla-central/rev/8164852113cd
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.