Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-07-22 Kent Tamura <tkent@chromium.org>
Reviewed by Ojan Vafai. Cancel button of search input field should fire input/change events https://bugs.webkit.org/show_bug.cgi?id=34393 * fast/forms/script-tests/search-cancel-button-events.js: Added. * fast/forms/search-cancel-button-events-expected.txt: Added. * fast/forms/search-cancel-button-events.html: Added. 2010-07-22 Kent Tamura <tkent@chromium.org> Reviewed by Ojan Vafai. Cancel button of search input field should fire input/change events https://bugs.webkit.org/show_bug.cgi?id=34393 Test: fast/forms/search-cancel-button-events.html * rendering/TextControlInnerElements.cpp: (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): Canonical link: https://commits.webkit.org/54765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
98 additions
and 0 deletions.
- +11 −0 LayoutTests/ChangeLog
- +37 −0 LayoutTests/fast/forms/script-tests/search-cancel-button-events.js
- +19 −0 LayoutTests/fast/forms/search-cancel-button-events-expected.txt
- +13 −0 LayoutTests/fast/forms/search-cancel-button-events.html
- +12 −0 WebCore/ChangeLog
- +6 −0 WebCore/rendering/TextControlInnerElements.cpp
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
@@ -0,0 +1,37 @@ | ||
description('Test for event dipatching by search cancel button.'); | ||
|
||
var parent = document.createElement('div'); | ||
document.body.appendChild(parent); | ||
parent.innerHTML = '<input type=search id=search value=foo><input id=another>'; | ||
var search = document.getElementById('search'); | ||
var anotherInput = document.getElementById('another'); | ||
var inputEventCounter = 0; | ||
var changeEventCounter = 0; | ||
|
||
search.onchange = function() { changeEventCounter++; }; | ||
search.oninput = function() { inputEventCounter++; }; | ||
|
||
if (window.eventSender) { | ||
debug('Initial state'); | ||
shouldBe('changeEventCounter', '0'); | ||
shouldBe('inputEventCounter', '0'); | ||
|
||
debug('Click the cancel button'); | ||
eventSender.mouseMoveTo(search.offsetLeft + search.offsetWidth - 8, search.offsetTop + search.offsetHeight / 2); | ||
eventSender.mouseDown(); | ||
eventSender.mouseUp(); | ||
shouldBe('search.value', '""'); | ||
shouldBe('changeEventCounter', '0'); | ||
shouldBe('inputEventCounter', '1'); | ||
|
||
debug('Focus on another field'); | ||
anotherInput.focus(); | ||
shouldBe('changeEventCounter', '1'); | ||
shouldBe('inputEventCounter', '1'); | ||
|
||
parent.innerHTML = ''; | ||
} else { | ||
document.getElementById('console').innerHTML = 'No eventSender'; | ||
} | ||
|
||
var successfullyParsed = true; |
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
@@ -0,0 +1,19 @@ | ||
Test for event dipatching by search cancel button. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
Initial state | ||
PASS changeEventCounter is 0 | ||
PASS inputEventCounter is 0 | ||
Click the cancel button | ||
PASS search.value is "" | ||
PASS changeEventCounter is 0 | ||
PASS inputEventCounter is 1 | ||
Focus on another field | ||
PASS changeEventCounter is 1 | ||
PASS inputEventCounter is 1 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> | ||
<script src="../../fast/js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="script-tests/search-cancel-button-events.js"></script> | ||
<script src="../../fast/js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
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