Title: [125743] trunk/LayoutTests
Revision
125743
Author
[email protected]
Date
2012-08-15 21:21:53 -0700 (Wed, 15 Aug 2012)

Log Message

[Tests] Copy to fast/forms/resources/common-wheel-event.js from fast/forms/number/number-wheel-event.html
https://bugs.webkit.org/show_bug.cgi?id=94184

Reviewed by Kent Tamura.

This patch copies fast/forms/number/number-wheel-event.html 
to fast/forms/resources/common-wheel-event.js for sharing
test code among input types.

* fast/forms/resources/common-wheel-event.js: Copied from LayoutTests/fast/forms/number/number-wheel-event.html.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125742 => 125743)


--- trunk/LayoutTests/ChangeLog	2012-08-16 03:56:38 UTC (rev 125742)
+++ trunk/LayoutTests/ChangeLog	2012-08-16 04:21:53 UTC (rev 125743)
@@ -1,3 +1,16 @@
+2012-08-15  Yoshifumi Inoue  <[email protected]>
+
+        [Tests] Copy to fast/forms/resources/common-wheel-event.js from fast/forms/number/number-wheel-event.html
+        https://bugs.webkit.org/show_bug.cgi?id=94184
+
+        Reviewed by Kent Tamura.
+
+        This patch copies fast/forms/number/number-wheel-event.html 
+        to fast/forms/resources/common-wheel-event.js for sharing
+        test code among input types.
+
+        * fast/forms/resources/common-wheel-event.js: Copied from LayoutTests/fast/forms/number/number-wheel-event.html.
+
 2012-08-15  Kiran Muppala  <[email protected]>
 
         (r125629): Newly added test css3/filters/custom/filter-fallback-to-software.html failing on mac

Copied: trunk/LayoutTests/fast/forms/resources/common-wheel-event.js (from rev 125742, trunk/LayoutTests/fast/forms/number/number-wheel-event.html) (0 => 125743)


--- trunk/LayoutTests/fast/forms/resources/common-wheel-event.js	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/common-wheel-event.js	2012-08-16 04:21:53 UTC (rev 125743)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Test for wheel operations for &lt;input type=number>');
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=number id=number value=0> <input id=another>';
+var input = document.getElementById('number');
+input.focus();
+
+function dispatchWheelEvent(element, deltaX, deltaY)
+{
+    var event = document.createEvent('WheelEvent');
+    var dontCare = 0;
+    event.initWebKitWheelEvent(deltaX, deltaY, document.defaultView, dontCare, dontCare, dontCare, dontCare, false, false, false, false);
+    element.dispatchEvent(event);
+}
+
+debug('Initial value is 0. We\'ll wheel up by 1:');
+dispatchWheelEvent(input, 0, 1);
+shouldBe('input.value', '"1"');
+
+debug('Wheel up by 100:');
+dispatchWheelEvent(input, 0, 100);
+shouldBe('input.value', '"2"');
+
+debug('Wheel down by 1:');
+dispatchWheelEvent(input, 0, -1);
+shouldBe('input.value', '"1"');
+
+debug('Wheel down by 256:');
+dispatchWheelEvent(input, 0, -256);
+shouldBe('input.value', '"0"');
+
+debug('Disabled input element:');
+input.disabled = true;
+dispatchWheelEvent(input, 0, 1);
+shouldBe('input.value', '"0"');
+input.removeAttribute('disabled');
+
+debug('Read-only input element:');
+input.readOnly = true;
+dispatchWheelEvent(input, 0, 1);
+shouldBe('input.value', '"0"');
+input.readOnly = false;
+
+debug('No focus:');
+document.getElementById('another').focus();
+dispatchWheelEvent(input, 0, 1);
+shouldBe('input.value', '"0"');
+
+parent.parentNode.removeChild(parent);
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to