Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html

Issue 2447653002: INPUT element: Do not dispatch events in detachLayoutTree(). (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html
index 98688a78063aec18aa9a165adeff6651dc60d75e..1e560cff4ed15573aeb56c4c3e05395e458c5dbd 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/color/input-color-onchange-event.html
@@ -8,6 +8,7 @@
<div id="console"></div>
<script>
description('Test if change event fires properly when color chooser changes. Bug 66848 <br> To manually test this, click on the input color element in the top left corner and change the value from the color chooser. See if the number of "value changed" messages matches the number of times you changed the color.');
+jsTestIsAsync = true;
var input = document.createElement('input');
input.type = 'color';
@@ -22,11 +23,6 @@ input.style.height = '20px';
var onChange = 0;
-input.onchange = function() {
- debug("change event dispatched - value changed to " + input.value);
- onChange++;
-};
-
input.oninput = function() {
debug("input event dispatched - value is: " + input.value);
};
@@ -39,21 +35,39 @@ eventSender.mouseUp();
shouldThrow("internals.selectColorInColorChooser({}, '#ff0000');");
shouldThrow("internals.selectColorInColorChooser(document, '#ff0000');");
-// input.onchange should be called
-internals.selectColorInColorChooser(input, '#ff0000');
-internals.endColorChooser(input);
-// input.onchange should not be called
-internals.selectColorInColorChooser(input, '#ff0000');
-internals.endColorChooser(input);
-shouldBe('input.value', '"#ff0000"');
-
-debug('Change event is only dispatched, when color chooser is closed');
-onChange = 0;
-internals.selectColorInColorChooser(input, '#ff0002');
-shouldBe('onChange', '0');
-internals.endColorChooser(input);
-shouldBe('onChange', '1');
+function step1() {
+ // input.onchange should be called
+ input.onchange = step2;
+ internals.selectColorInColorChooser(input, '#ff0000');
+ internals.endColorChooser(input);
+ shouldBe('input.value', '"#ff0000"');
+}
+
+function step2() {
+ debug("change event dispatched - value changed to " + input.value);
+ // input.onchange should not be called
+ input.onchange = () => {
+ testFailed("Change event should not be dispatched.");
+ };
+ internals.selectColorInColorChooser(input, '#ff0000');
+ internals.endColorChooser(input);
+ shouldBe('input.value', '"#ff0000"');
+ step3();
+}
+
+function step3() {
+ debug('Change event is only dispatched, when color chooser is closed');
+ input.onchange = step4;
+ internals.selectColorInColorChooser(input, '#ff0002');
+ internals.endColorChooser(input);
+}
+
+function step4() {
+ testPassed('Change event was dispatched.');
+ finishJSTest();
+}
+step1();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698