Index: LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-choose-default-value-after-set-value.html |
diff --git a/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-choose-default-value-after-set-value.html b/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-choose-default-value-after-set-value.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2007288f0bdc7d8af4cfb22660bd4e767401238d |
--- /dev/null |
+++ b/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-choose-default-value-after-set-value.html |
@@ -0,0 +1,45 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../fast/js/resources/js-test-pre.js"></script> |
+<script src="../resources/common.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<div id="console"></div> |
+<input type="month" id="input" value="2000-01"> |
+<script> |
+description('Test if change event fires when the user selects the default value after the value was changed by JS.'); |
+ |
+var eventsCounter = {}; |
+function recordEvent(event) { |
+ if (eventsCounter[event.type] === undefined) |
+ eventsCounter[event.type] = 0; |
+ eventsCounter[event.type]++; |
+ debug('==> "' + event.type + '" event was dispatched.'); |
+} |
+ |
+var input = document.getElementById('input'); |
+input.addEventListener('input', recordEvent, false); |
+input.addEventListener('change', recordEvent, false); |
+ |
+input.value = '2001-01'; |
+ |
+shouldBeEqualToString('input.value', '2001-01'); |
+shouldBeUndefined('eventsCounter.input'); |
+shouldBeUndefined('eventsCounter.change'); |
+ |
+// We assume the year-month format is "MMM yyyy". |
+ |
+input.focus(); |
+eventSender.keyDown('rightArrow'); |
+eventSender.keyDown('downArrow'); |
+ |
+shouldBeEqualToString('input.value', '2000-01'); |
+shouldBe('eventsCounter.input', '1'); |
+shouldBe('eventsCounter.change', '1'); |
+ |
+</script> |
+<script src="../../../fast/js/resources/js-test-post.js"></script> |
+</body> |
+</html> |