Index: LayoutTests/fast/forms/radio-checkbox-events-order.html |
diff --git a/LayoutTests/fast/forms/radio-checkbox-events-order.html b/LayoutTests/fast/forms/radio-checkbox-events-order.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27ef041416eccbafce83575cc8679e8322f69e58 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/radio-checkbox-events-order.html |
@@ -0,0 +1,80 @@ |
+<!DOCTYPE HTML> |
+ |
+<script src="../../resources/js-test.js"></script> |
+ |
+<body> |
+<input type="checkbox" id="checkbox-btn1" onclick="doClickAction(event)" onchange="doChangeAction(event)"/> |
+<input type="checkbox" id="checkbox-btn2" onclick="doClickAction(event); event.preventDefault()" onchange="doChangeAction(event)"/> |
+<input type="radio" id="radio-btn1" onclick="doClickAction(event)" onchange="doChangeAction(event)"/> |
+<input type="radio" id="radio-btn2" onclick="doClickAction(event); event.preventDefault()" onchange="doChangeAction(event)"/> |
+<script> |
+description('Tests the order of onclick and onchange'); |
+var message = ''; |
+ |
+function doClickAction(e) |
+{ |
+ shouldBeEqualToString('message', ''); |
+ message = 'clicked'; |
+} |
+ |
+function doChangeAction(e) |
+{ |
+ shouldBeEqualToString('message', 'clicked'); |
+ message = 'checked'; |
+} |
+ |
+var checkbox1 = document.getElementById('checkbox-btn1'); |
+var checkbox2 = document.getElementById('checkbox-btn2'); |
+var radio1 = document.getElementById('radio-btn1'); |
+var radio2 = document.getElementById('radio-btn2'); |
+ |
+message = ''; |
+checkbox1.click(); |
+shouldBeEqualToString('message', 'checked'); |
+shouldBeTrue('checkbox1.checked'); |
+ |
+message = ''; |
+checkbox2.click(); |
+shouldBeEqualToString('message', 'clicked'); |
+shouldBeFalse('checkbox2.checked'); |
+ |
+message = ''; |
+checkbox1.checked = false; |
+checkbox1.focus(); |
+eventSender.keyDown(' '); |
+shouldBeEqualToString('message', 'checked'); |
+shouldBeTrue('checkbox1.checked'); |
+ |
+message = ''; |
+checkbox2.checked = false; |
+checkbox2.focus(); |
+eventSender.keyDown(' '); |
+shouldBeEqualToString('message', 'clicked'); |
+shouldBeFalse('checkbox2.checked'); |
+ |
+message = ''; |
+radio1.click(); |
+shouldBeEqualToString('message', 'checked'); |
+shouldBeTrue('radio1.checked'); |
+ |
+message = ''; |
+radio2.click(); |
+shouldBeEqualToString('message', 'clicked'); |
+shouldBeFalse('radio2.checked'); |
+ |
+message = ''; |
+radio1.checked = false; |
+radio1.focus(); |
+eventSender.keyDown(' '); |
+shouldBeEqualToString('message', 'checked'); |
+shouldBeTrue('radio1.checked'); |
+ |
+message = ''; |
+radio2.checked = false; |
+radio2.focus(); |
+eventSender.keyDown(' '); |
+shouldBeEqualToString('message', 'clicked'); |
+shouldBeFalse('radio2.checked'); |
+ |
+</script> |
+</body> |