Commit 14d043a2 authored by yosin@chromium.org's avatar yosin@chromium.org
Browse files

[Tests] We should have test for clicking spin button in iframe.

https://bugs.webkit.org/show_bug.cgi?id=96612

Reviewed by Kent Tamura.

This patch adds two tests for clicking spin button in iframe for
input type "number" and input type "time" with multiple fields UI.

These tests are added for catching regression caused by r127876.

* fast/forms/number/number-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/number/number-spinbutton-click-in-iframe.html: Added.
* fast/forms/resources/common-spinbutton-click-in-iframe.js: Added.
(getSpinButton): Extracts spin button in shadow DOM tree.
(mouseClick): Simulates mouse click.
(mouseMoveTo): Simulates mouse pointer move.
(runIFrameLoaded): Checking spin button clicked.
(testClickSpinButtonInIFrame): Creates and populates iframe.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b616718d
2012-09-13 Yoshifumi Inoue <yosin@chromium.org>
[Tests] We should have test for clicking spin button in iframe.
https://bugs.webkit.org/show_bug.cgi?id=96612
Reviewed by Kent Tamura.
This patch adds two tests for clicking spin button in iframe for
input type "number" and input type "time" with multiple fields UI.
These tests are added for catching regression caused by r127876.
* fast/forms/number/number-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/number/number-spinbutton-click-in-iframe.html: Added.
* fast/forms/resources/common-spinbutton-click-in-iframe.js: Added.
(getSpinButton): Extracts spin button in shadow DOM tree.
(mouseClick): Simulates mouse click.
(mouseMoveTo): Simulates mouse pointer move.
(runIFrameLoaded): Checking spin button clicked.
(testClickSpinButtonInIFrame): Creates and populates iframe.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe-expected.txt: Added.
* fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html: Added.
2012-09-13 Zan Dobersek <zandobersek@gmail.com>
 
Unreviewed GTK gardening.
Checks mouse click on spin button in iframe.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS testInput.value is "12346"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
<script src="../resources/common-spinbutton-click-in-iframe.js"></script>
</head>
<body>
<script>
testClickSpinButtonInIFrame({
'expectedValue' : '12346',
'initialValue' : '12345',
'inputType' : 'number'
});
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
window.jsTestIsAsync = true;
var iframe;
var testInput;
function getSpinButton(input)
{
if (!window.internals)
return null;
var editElement = window.internals.oldestShadowRoot(input);
return editElement.firstChild.lastChild;
}
function mouseClick()
{
if (!window.eventSender)
return;
eventSender.mouseDown();
eventSender.mouseUp();
}
function mouseMoveTo(x, y)
{
if (!window.eventSender)
return;
eventSender.mouseMoveTo(x, y);
}
function runIFrameLoaded(config)
{
testInput = iframe.contentDocument.getElementById('test');
var spinButton = getSpinButton(testInput);
if (spinButton) {
mouseMoveTo(
iframe.offsetLeft + spinButton.offsetLeft + spinButton.offsetWidth / 2,
iframe.offsetTop + spinButton.offsetTop + spinButton.offsetHeight / 4);
}
mouseClick();
shouldBeEqualToString('testInput.value', config['expectedValue']);
iframe.parentNode.removeChild(iframe);
finishJSTest();
}
function testClickSpinButtonInIFrame(config)
{
description('Checks mouse click on spin button in iframe.');
if (!window.eventSender)
debug('Please run in DumpRenderTree');
iframe = document.createElement('iframe');
iframe.addEventListener('load', function () { runIFrameLoaded(config) });
iframe.srcdoc = '<input id=test type=' + config['inputType'] + ' value="' + config['initialValue'] + '">';
document.body.appendChild(iframe);
}
Checks mouse click on spin button in iframe.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS testInput.value is "01:00"
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
<script src="../resources/common-spinbutton-click-in-iframe.js"></script>
</head>
<body>
<script>
testClickSpinButtonInIFrame({
'expectedValue' : '01:00',
'initialValue' : '00:00',
'inputType' : 'time'
});
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment