Index: LayoutTests/fast/forms/range/range-keyboard-oninput-event.html |
diff --git a/LayoutTests/fast/forms/range/range-keyboard-oninput-event.html b/LayoutTests/fast/forms/range/range-keyboard-oninput-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a6a48ab77c64e52c45aa679272b9bbcf75985661 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/range/range-keyboard-oninput-event.html |
@@ -0,0 +1,41 @@ |
+<html> |
+<head> |
+<script src="../../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<input type="range" id="slider" oninput="log(event)" onchange="log(event)" min=0 max=100 value=50> |
+<script> |
+ description('Test that for each keyboard event both input and change event are dispatched'); |
tkent
2014/03/04 22:24:28
nit: You don't need to indent the whole content of
|
+ var changeEventCounter = 0; |
+ var lastChangeEventCounter = changeEventCounter; |
+ var inputEventCounter = 0; |
+ var lastInputEventCounter = inputEventCounter; |
+ |
+ function log(event) { |
+ if (event.type == 'input') |
+ inputEventCounter++; |
+ if (event.type == 'change') |
+ changeEventCounter++; |
+ } |
+ |
+ function testInput() { |
+ var slider = document.getElementById('slider'); |
+ if (window.testRunner) { |
+ // slider drag |
+ slider.focus(); |
+ debug('Move left'); |
+ eventSender.keyDown('leftArrow'); |
+ shouldBeGreaterThanOrEqual('inputEventCounter' , 'lastInputEventCounter + 1'); |
+ shouldBeGreaterThanOrEqual('changeEventCounter', 'lastChangeEventCounter + 1'); |
+ debug('Move right'); |
+ lastInputEventCounter = inputEventCounter; |
+ lastChangeEventCounter = changeEventCounter; |
+ eventSender.keyDown('rightArrow'); |
+ shouldBeGreaterThanOrEqual('inputEventCounter' , 'lastInputEventCounter + 1'); |
+ shouldBeGreaterThanOrEqual('changeEventCounter', 'lastChangeEventCounter + 1'); |
+ } |
+ } |
+ testInput(); |
+</script> |
+</body> |
+</html> |