Changeset 207509 in webkit
- Timestamp:
- Oct 18, 2016 5:27:59 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207506 r207509 1 2016-10-18 Chris Dumez <cdumez@apple.com> 2 3 Provide better form validation messages 4 https://bugs.webkit.org/show_bug.cgi?id=163584 5 6 Reviewed by Darin Adler. 7 8 Update existing tests now that form validation messages differ. 9 10 * fast/forms/number/number-validation-message-expected.txt: 11 * fast/forms/number/number-validation-message.html: 12 * fast/forms/validationMessage-expected.txt: 13 * platform/mac/fast/forms/validation-message-appearance-expected.txt: 14 1 15 2016-10-18 Ryan Haddad <ryanhaddad@apple.com> 2 16 -
trunk/LayoutTests/fast/forms/date/input-date-validation-message-expected.txt
r121019 r207509 7 7 PASS testIt("", "", "") is "" 8 8 Value missing 9 PASS testIt("", "", "") is "value missing" 9 FAIL testIt("", "", "") should be value missing. Was Please fill out this field.. 10 10 Type mismatch 11 11 PASS testIt("foo", "", "") is "" 12 12 Range overflow 13 PASS testIt("1982-11-02", "", "1970-12-31") is "range overflow" 13 FAIL testIt("1982-11-02", "", "1970-12-31") should be range overflow. Was Value must be less than or equal to 1970-12-31.. 14 14 Range underflow 15 PASS testIt("1982-11-02", "1990-05-25", "1990-12-24") is "range underflow" 15 FAIL testIt("1982-11-02", "1990-05-25", "1990-12-24") should be range underflow. Was Value must be greater than or equal to 1990-05-25.. 16 16 Step mismatch 17 PASS testIt("1982-11-02", "", "", "123") is "step mismatch" 17 FAIL testIt("1982-11-02", "", "", "123") should be step mismatch. Was Please enter a valid value.. 18 18 PASS successfullyParsed is true 19 19 -
trunk/LayoutTests/fast/forms/number/number-validation-message-expected.txt
r123302 r207509 7 7 PASS testIt("", "", "") is "" 8 8 Value missing 9 PASS testIt("", "", "") is " value missing"9 PASS testIt("", "", "") is "Please fill out this field." 10 10 Type mismatch 11 11 PASS testIt("foo", "", "") is "" 12 12 Range overflow 13 PASS testIt("200", "", "100") is " range overflow"13 PASS testIt("200", "", "100") is "Value must be less than or equal to 100." 14 14 Range underflow 15 PASS testIt("10", "50", "100") is " range underflow"15 PASS testIt("10", "50", "100") is "Value must be greater than or equal to 50." 16 16 Step mismatch 17 PASS testIt("55", "0", "100", "10") is " step mismatch"17 PASS testIt("55", "0", "100", "10") is "Please enter a valid value." 18 18 PASS successfullyParsed is true 19 19 -
trunk/LayoutTests/fast/forms/number/number-validation-message.html
r155268 r207509 26 26 debug('Value missing') 27 27 input.setAttribute("required", ""); 28 shouldBeEqualToString('testIt("", "", "")', ' value missing');28 shouldBeEqualToString('testIt("", "", "")', 'Please fill out this field.'); 29 29 input.removeAttribute("required"); 30 30 … … 33 33 34 34 debug('Range overflow') 35 shouldBeEqualToString('testIt("200", "", "100")', ' range overflow');35 shouldBeEqualToString('testIt("200", "", "100")', 'Value must be less than or equal to 100.'); 36 36 37 37 debug('Range underflow') 38 shouldBeEqualToString('testIt("10", "50", "100")', ' range underflow');38 shouldBeEqualToString('testIt("10", "50", "100")', 'Value must be greater than or equal to 50.'); 39 39 40 40 debug('Step mismatch') 41 shouldBeEqualToString('testIt("55", "0", "100", "10")', ' step mismatch');41 shouldBeEqualToString('testIt("55", "0", "100", "10")', 'Please enter a valid value.'); 42 42 43 43 </script> -
trunk/LayoutTests/fast/forms/validationMessage-expected.txt
r147119 r207509 4 4 5 5 6 input patternMismatch: pattern mismatch7 input valueMissing: value missing8 textarea valueMissing: value missing9 select valueMissing: value missing10 input typeMismatch: type mismatch11 input badInput: type mismatch6 input patternMismatch: Please match the requested format. 7 input valueMissing: Please fill out this field. 8 textarea valueMissing: Please fill out this field. 9 select valueMissing: Please select an item in the list. 10 input typeMismatch: Please enter an email address. 11 input badInput: Please enter a number. 12 12 badInput and valueMissing: 13 13 PASS numberInput.validationMessage is nonRequiredBadInputMessage -
trunk/LayoutTests/platform/mac-elcapitan/fast/forms/validation-message-appearance-expected.txt
r202826 r207509 26 26 RenderBlock {DIV} at (10,10) size 200x64 27 27 RenderBlock {DIV} at (0,0) size 200x16 28 RenderText {#text} at (0,0) size 90x1629 text run at (0,0) width 90: "value missing"28 RenderText {#text} at (0,0) size 153x16 29 text run at (0,0) width 153: "Please fill out this field." 30 30 RenderBlock {DIV} at (0,16) size 200x48 31 31 RenderText {#text} at (0,0) size 147x16 -
trunk/LayoutTests/platform/mac/fast/forms/validation-message-appearance-expected.txt
r202826 r207509 26 26 RenderBlock {DIV} at (10,10) size 200x64 27 27 RenderBlock {DIV} at (0,0) size 200x16 28 RenderText {#text} at (0,0) size 88x1629 text run at (0,0) width 88: "value missing"28 RenderText {#text} at (0,0) size 152x16 29 text run at (0,0) width 152: "Please fill out this field." 30 30 RenderBlock {DIV} at (0,16) size 200x48 31 31 RenderText {#text} at (0,0) size 145x16 -
trunk/Source/WebCore/ChangeLog
r207507 r207509 1 2016-10-18 Chris Dumez <cdumez@apple.com> 2 3 Provide better form validation messages 4 https://bugs.webkit.org/show_bug.cgi?id=163584 5 6 Reviewed by Darin Adler. 7 8 Provide better form validation messages that match more closely the ones 9 from Chrome and Firefox. 10 11 No new tests, updated existing tests. 12 13 * English.lproj/Localizable.strings: 14 * platform/LocalizedStrings.cpp: 15 (WebCore::validationMessageValueMissingText): 16 (WebCore::validationMessageValueMissingForCheckboxText): 17 (WebCore::validationMessageValueMissingForFileText): 18 (WebCore::validationMessageValueMissingForMultipleFileText): 19 (WebCore::validationMessageValueMissingForRadioText): 20 (WebCore::validationMessageValueMissingForSelectText): 21 (WebCore::validationMessageTypeMismatchText): 22 (WebCore::validationMessageTypeMismatchForEmailText): 23 (WebCore::validationMessageTypeMismatchForMultipleEmailText): 24 (WebCore::validationMessageTypeMismatchForURLText): 25 (WebCore::validationMessagePatternMismatchText): 26 (WebCore::validationMessageTooShortText): 27 (WebCore::validationMessageTooLongText): 28 (WebCore::validationMessageRangeUnderflowText): 29 (WebCore::validationMessageRangeOverflowText): 30 (WebCore::validationMessageStepMismatchText): 31 (WebCore::validationMessageBadInputForNumberText): 32 1 33 2016-10-18 Dave Hyatt <hyatt@apple.com> 2 34 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r207429 r207509 218 218 "Cut (Undo action name)" = "Cut"; 219 219 220 /* accessibility role description for a date field */221 "date field" = "date field";222 223 220 /* Default writing direction context menu item */ 224 221 "Default" = "Default"; … … 248 245 "Drag (Undo action name)" = "Drag"; 249 246 250 /* accessibility role description for an email field */251 "email field" = "email field";252 253 247 /* Video Enter Fullscreen context menu item */ 254 248 "Enter Full Screen" = "Enter Full Screen"; … … 311 305 "Inspect Element" = "Inspect Element"; 312 306 307 /* Validation message for input form controls with a value not matching type */ 308 "Invalid value." = "Invalid value."; 309 313 310 /* Italic context menu item */ 314 311 "Italic" = "Italic"; … … 467 464 "Play movie in fullscreen mode" = "Play movie in fullscreen mode"; 468 465 466 /* Validation message for required checkboxes that have not be checked */ 467 "Please check this box if you want to proceed." = "Please check this box if you want to proceed."; 468 469 /* Validation message for input form controls of type 'url' that have an invalid value */ 470 "Please enter a URL." = "Please enter a URL."; 471 472 /* Validation message for number fields where the user entered a non-number string */ 473 "Please enter a number." = "Please enter a number."; 474 475 /* Validation message for input form controls with value not respecting the step attribute */ 476 "Please enter a valid value." = "Please enter a valid value."; 477 478 /* Validation message for input form controls of type 'email' that have an invalid value */ 479 "Please enter an email address." = "Please enter an email address."; 480 481 /* Validation message for required form control elements that have no value */ 482 "Please fill out this field." = "Please fill out this field."; 483 484 /* Validation message for input form controls requiring a constrained value according to pattern */ 485 "Please match the requested format." = "Please match the requested format."; 486 487 /* Validation message for required file inputs that have no value */ 488 "Please select a file." = "Please select a file."; 489 490 /* Validation message for required menu list controls that have no selection */ 491 "Please select an item in the list." = "Please select an item in the list."; 492 493 /* Validation message for required radio boxes that have no selection */ 494 "Please select one of these options." = "Please select one of these options."; 495 496 /* Validation message for form control elements with a value shorter than minimum allowed length */ 497 "Please use at least %d characters." = "Please use at least %d characters."; 498 499 /* Validation message for form control elements with a value shorter than maximum allowed length */ 500 "Please use no more than %d characters." = "Please use no more than %d characters."; 501 469 502 /* Label text to be used if plugin host process has crashed */ 470 503 "Plug-in Failure" = "Plug-in Failure"; … … 620 653 "Take Video (file upload action sheet)" = "Take Video"; 621 654 622 /* accessibility role description for a telephone number field */623 "telephone number field" = "telephone number field";624 625 655 /* Text Replacement context menu item */ 626 656 "Text Replacement" = "Text Replacement"; … … 689 719 "Typing (Undo action name)" = "Typing"; 690 720 721 /* accessibility role description for a URL field. */ 722 "URL field" = "URL field"; 723 691 724 /* Underline context menu item */ 692 725 "Underline" = "Underline"; … … 722 755 "Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB" = "Used to encrypt WebCrypto keys in persistent storage, such as IndexedDB"; 723 756 757 /* Validation message for input form controls with value lower than allowed minimum */ 758 "Value must be greater than or equal to %@." = "Value must be greater than or equal to %@."; 759 760 /* Validation message for input form controls with value higher than allowed maximum */ 761 "Value must be less than or equal to %@." = "Value must be less than or equal to %@."; 762 724 763 /* Web Inspector window title when inspecting Web Inspector */ 725 764 "Web Inspector [%d] — %@" = "Web Inspector [%d] — %@"; … … 812 851 "current movie time in seconds" = "current movie time in seconds"; 813 852 853 /* accessibility role description for a date field. */ 854 "date field" = "date field"; 855 814 856 /* role description of ARIA definition role */ 815 857 "definition" = "definition"; … … 830 872 "elapsed time" = "elapsed time"; 831 873 874 /* accessibility role description for an email field. */ 875 "email field" = "email field"; 876 832 877 /* accessibility label for enter fullscreen button */ 833 878 "enter fullscreen" = "enter fullscreen"; … … 980 1025 "password auto fill" = "password auto fill"; 981 1026 982 /* Validation message for input form controls requiring a constrained value according to pattern */983 "pattern mismatch" = "pattern mismatch";984 985 1027 /* accessibility label for pause button */ 986 1028 "pause" = "pause"; … … 1076 1118 "status" = "status"; 1077 1119 1078 /* Validation message for input form controls with value not respecting the step attribute */1079 "step mismatch" = "step mismatch";1080 1081 1120 /* accessibility help text for hide closed captions button */ 1082 1121 "stop displaying closed captions" = "stop displaying closed captions"; … … 1094 1133 "tab panel" = "tab panel"; 1095 1134 1135 /* accessibility role description for a telephone number field. */ 1136 "telephone number field" = "telephone number field"; 1137 1096 1138 /* HTTP result code string */ 1097 1139 "temporarily redirected" = "temporarily redirected"; … … 1100 1142 "term" = "term"; 1101 1143 1102 /* accessibility role description for a time field */1144 /* accessibility role description for a time field. */ 1103 1145 "time field" = "time field"; 1104 1146 … … 1109 1151 "timer" = "timer"; 1110 1152 1111 /* Validation message for form control elements with a value longer than maximum allowed length */1112 "too long" = "too long";1113 1114 /* Validation message for form control elements with a value shorter than minimum allowed length */1115 "too short" = "too short";1116 1117 1153 /* An ARIA accessibility group that acts as a tooltip. */ 1118 1154 "tooltip" = "tooltip"; 1119 1155 1120 /* Validation message for input form controls with a value not matching type */1121 "type mismatch" = "type mismatch";1122 1123 1156 /* HTTP result code string */ 1124 1157 "unacceptable" = "unacceptable"; … … 1148 1181 "unsupported version" = "unsupported version"; 1149 1182 1150 /* accessibility role description for a URL field */1151 "URL field" = "URL field";1152 1153 /* Validation message for required form control elements that have no value */1154 "value missing" = "value missing";1155 1156 1183 /* accessibility help text for video element controller */ 1157 1184 "video element playback controls and status display" = "video element playback controls and status display"; -
trunk/Source/WebCore/platform/LocalizedStrings.cpp
r207429 r207509 1051 1051 String validationMessageValueMissingText() 1052 1052 { 1053 return WEB_UI_STRING(" value missing", "Validation message for required form control elements that have no value");1053 return WEB_UI_STRING("Please fill out this field.", "Validation message for required form control elements that have no value"); 1054 1054 } 1055 1055 1056 1056 String validationMessageValueMissingForCheckboxText() 1057 1057 { 1058 return validationMessageValueMissingText();1058 return WEB_UI_STRING("Please check this box if you want to proceed.", "Validation message for required checkboxes that have not be checked"); 1059 1059 } 1060 1060 1061 1061 String validationMessageValueMissingForFileText() 1062 1062 { 1063 return validationMessageValueMissingText();1063 return WEB_UI_STRING("Please select a file.", "Validation message for required file inputs that have no value"); 1064 1064 } 1065 1065 1066 1066 String validationMessageValueMissingForMultipleFileText() 1067 1067 { 1068 return validationMessageValueMissing Text();1068 return validationMessageValueMissingForFileText(); 1069 1069 } 1070 1070 1071 1071 String validationMessageValueMissingForRadioText() 1072 1072 { 1073 return validationMessageValueMissingText();1073 return WEB_UI_STRING("Please select one of these options.", "Validation message for required radio boxes that have no selection"); 1074 1074 } 1075 1075 1076 1076 String validationMessageValueMissingForSelectText() 1077 1077 { 1078 return validationMessageValueMissingText();1078 return WEB_UI_STRING("Please select an item in the list.", "Validation message for required menu list controls that have no selection"); 1079 1079 } 1080 1080 1081 1081 String validationMessageTypeMismatchText() 1082 1082 { 1083 return WEB_UI_STRING(" type mismatch", "Validation message for input form controls with a value not matching type");1083 return WEB_UI_STRING("Invalid value.", "Validation message for input form controls with a value not matching type"); 1084 1084 } 1085 1085 1086 1086 String validationMessageTypeMismatchForEmailText() 1087 1087 { 1088 return validationMessageTypeMismatchText();1088 return WEB_UI_STRING("Please enter an email address.", "Validation message for input form controls of type 'email' that have an invalid value"); 1089 1089 } 1090 1090 1091 1091 String validationMessageTypeMismatchForMultipleEmailText() 1092 1092 { 1093 return validationMessageTypeMismatch Text();1093 return validationMessageTypeMismatchForEmailText(); 1094 1094 } 1095 1095 1096 1096 String validationMessageTypeMismatchForURLText() 1097 1097 { 1098 return validationMessageTypeMismatchText();1098 return WEB_UI_STRING("Please enter a URL.", "Validation message for input form controls of type 'url' that have an invalid value"); 1099 1099 } 1100 1100 1101 1101 String validationMessagePatternMismatchText() 1102 1102 { 1103 return WEB_UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern"); 1104 } 1105 1106 String validationMessageTooShortText(int, int) 1107 { 1108 return WEB_UI_STRING("too short", "Validation message for form control elements with a value shorter than minimum allowed length"); 1109 } 1110 1111 String validationMessageTooLongText(int, int) 1112 { 1113 return WEB_UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length"); 1114 } 1115 1116 String validationMessageRangeUnderflowText(const String&) 1117 { 1103 return WEB_UI_STRING("Please match the requested format.", "Validation message for input form controls requiring a constrained value according to pattern"); 1104 } 1105 1106 String validationMessageTooShortText(int, int minLength) 1107 { 1108 return formatLocalizedString(WEB_UI_STRING("Please use at least %d characters.", "Validation message for form control elements with a value shorter than minimum allowed length"), minLength); 1109 } 1110 1111 String validationMessageTooLongText(int, int maxLength) 1112 { 1113 return formatLocalizedString(WEB_UI_STRING("Please use no more than %d characters.", "Validation message for form control elements with a value shorter than maximum allowed length"), maxLength); 1114 } 1115 1116 String validationMessageRangeUnderflowText(const String& minimum) 1117 { 1118 #if PLATFORM(COCOA) 1119 return formatLocalizedString(WEB_UI_STRING("Value must be greater than or equal to %@.", "Validation message for input form controls with value lower than allowed minimum"), minimum.createCFString().get()); 1120 #else 1121 UNUSED_PARAM(minimum); 1118 1122 return WEB_UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum"); 1119 } 1120 1121 String validationMessageRangeOverflowText(const String&) 1122 { 1123 #endif 1124 } 1125 1126 String validationMessageRangeOverflowText(const String& maximum) 1127 { 1128 #if PLATFORM(COCOA) 1129 return formatLocalizedString(WEB_UI_STRING("Value must be less than or equal to %@.", "Validation message for input form controls with value higher than allowed maximum"), maximum.createCFString().get()); 1130 #else 1131 UNUSED_PARAM(maximum); 1123 1132 return WEB_UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum"); 1133 #endif 1124 1134 } 1125 1135 1126 1136 String validationMessageStepMismatchText(const String&, const String&) 1127 1137 { 1128 return WEB_UI_STRING(" step mismatch", "Validation message for input form controls with value not respecting the step attribute");1138 return WEB_UI_STRING("Please enter a valid value.", "Validation message for input form controls with value not respecting the step attribute"); 1129 1139 } 1130 1140 1131 1141 String validationMessageBadInputForNumberText() 1132 1142 { 1133 notImplemented(); 1134 return validationMessageTypeMismatchText(); 1143 return WEB_UI_STRING("Please enter a number.", "Validation message for number fields where the user entered a non-number string"); 1135 1144 } 1136 1145
Note: See TracChangeset
for help on using the changeset viewer.