forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <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> |