mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 829101 - Update tests for <input type='{email,number}'> value sanitization tests. r=Ms2ger
This commit is contained in:
parent
cc8d25757d
commit
b01f8b10fb
@ -52,9 +52,9 @@ function sanitizeValue(aType, aValue)
|
||||
return aValue.replace(/[\n\r]/g, "");
|
||||
case "url":
|
||||
case "email":
|
||||
return aValue.replace(/[\n\r]/g, "").replace(/^\s+|\s+$/g, "");
|
||||
return aValue.replace(/[\n\r]/g, "").replace(/^[\u0020\u0009\t\u000a\u000c\u000d]+|[\u0020\u0009\t\u000a\u000c\u000d]+$/g, "");
|
||||
case "number":
|
||||
return (parseFloat(aValue) + "" === aValue) ? aValue : "";
|
||||
return isNaN(Number(aValue)) ? "" : aValue;
|
||||
case "date":
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-date-string
|
||||
function getNumbersOfDaysInMonth(aMonth, aYear) {
|
||||
@ -145,10 +145,19 @@ function checkSanitizing(element)
|
||||
" foo\n\r bar ",
|
||||
// For url:
|
||||
"\r\n foobar \n\r",
|
||||
"\u000B foo \u000B",
|
||||
"\u000A foo \u000A",
|
||||
"\u000C foo \u000C",
|
||||
"\u000d foo \u000d",
|
||||
"\u0020 foo \u0020",
|
||||
" \u0009 foo \u0009 ",
|
||||
// For number:
|
||||
"42",
|
||||
"13.37",
|
||||
"1.234567898765432",
|
||||
"12foo",
|
||||
"1e2",
|
||||
"3E42",
|
||||
// For date:
|
||||
"1970-01-01",
|
||||
"1234-12-12",
|
||||
|
Loading…
Reference in New Issue
Block a user