Permalink
Browse files

[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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125743 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information...
1 parent 4c44c59 commit 394adb67cf385ca52e13a4a7aa482373132cb10a @yosinch yosinch committed Aug 16, 2012
Showing with 73 additions and 0 deletions.
  1. +13 −0 LayoutTests/ChangeLog
  2. +60 −0 LayoutTests/fast/forms/resources/common-wheel-event.js
View
@@ -1,3 +1,16 @@
+2012-08-15 Yoshifumi Inoue <yosin@chromium.org>
+
+ [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 <cmuppala@apple.com>
(r125629): Newly added test css3/filters/custom/filter-fallback-to-software.html failing on mac
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</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="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>

0 comments on commit 394adb6

Please sign in to comment.