Skip to content

Commit

Permalink
[Tests] Copy to fast/forms/resources/common-wheel-event.js from fast/…
Browse files Browse the repository at this point in the history
…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
yosinch committed Aug 16, 2012
1 parent 4c44c59 commit 394adb6
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
13 changes: 13 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
60 changes: 60 additions & 0 deletions LayoutTests/fast/forms/resources/common-wheel-event.js
Original file line number Diff line number Diff line change
@@ -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.