https://bugs.webkit.org/show_bug.cgi?id=83863
Reviewed by Kentaro Hara.
Source/WebCore:
Test: fast/forms/date/input-date-commit-valid-only.html
* html/DateInputType.cpp:
(WebCore::DateInputType::handleBlurEvent):
Reset the visible value. The code is same as NumberInputType::handleBlurEvent().
LayoutTests:
* fast/forms/date/input-date-commit-valid-only-expected.txt: Added.
* fast/forms/date/input-date-commit-valid-only.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114092
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-04-13 Kent Tamura <tkent@chromium.org>
+ Should clear an invalid string in a date field on blur
+ https://bugs.webkit.org/show_bug.cgi?id=83863
+
+ Reviewed by Kentaro Hara.
+
+ * fast/forms/date/input-date-commit-valid-only-expected.txt: Added.
+ * fast/forms/date/input-date-commit-valid-only.html: Added.
+
+2012-04-13 Kent Tamura <tkent@chromium.org>
+
[Chromium] <input type=date> tests should pass.
* platform/chromium/test_expectations.txt:
--- /dev/null
+Type=date field should not accept invalid date strings though a user can type such strings
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.value is "2012-04-13"
+PASS document.getSelection().toString() == "+++" is false
+PASS input.value is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description('Type=date field should not accept invalid date strings though a user can type such strings');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type="date" id="date" value="2012-04-13">';
+
+var input = document.getElementById('date');
+input.focus();
+document.execCommand('SelectAll', false, null);
+document.execCommand('InsertText', false, '+++');
+input.blur();
+shouldBe('input.value', '"2012-04-13"');
+input.focus();
+document.execCommand('SelectAll', false, null);
+shouldBeFalse('document.getSelection().toString() == "+++"');
+
+input.focus();
+document.execCommand('SelectAll', false, null);
+document.execCommand('InsertText', false, '');
+input.blur();
+shouldBe('input.value', '""');
+</script>
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
+2012-04-13 Kent Tamura <tkent@chromium.org>
+
+ Should clear an invalid string in a date field on blur
+ https://bugs.webkit.org/show_bug.cgi?id=83863
+
+ Reviewed by Kentaro Hara.
+
+ Test: fast/forms/date/input-date-commit-valid-only.html
+
+ * html/DateInputType.cpp:
+ (WebCore::DateInputType::handleBlurEvent):
+ Reset the visible value. The code is same as NumberInputType::handleBlurEvent().
+
2012-04-12 Kent Tamura <tkent@chromium.org>
Calendar Picker: remove unnecessary code from calendarPicker.{css,js}
{
if (m_pickerElement)
m_pickerElement->closePopup();
+
+ // Reset the renderer value, which might be unmatched with the element value.
+ element()->setFormControlValueMatchesRenderer(false);
+ // We need to reset the renderer value explicitly because an unacceptable
+ // renderer value should be purged before style calculation.
+ element()->updateInnerTextValue();
}
#endif // ENABLE(CALENDAR_PICKER)