Reviewers: kpreid2,
Description:
This addresses
https://code.google.com/p/google-caja/issues/detail?id=1779
Symptom is we expect
mousedown,1,mousedown,3,mouseup,1,mouseup,3
but we get
mouseup,1,mouseup,3
I haven't been able to reproduce it, but I think what's happening is
that the webdriver click() puts a small delay between mousedown and
mouseup events, and in that interval we happen to run the testcase,
which installs mousedown and mouseup handlers, and then sees
results from just the mouseup events firing.
This fix just reduces the test to mouseup handlers, since it's
intended to test that repeated calls to addEventListener do
the expected thing, and there's nothing special about testing
both mouseup and mousedown.
Please review this at https://codereview.appspot.com/13414043/
Affected files:
M tests/com/google/caja/plugin/test-domado-events-guest.html
Index: tests/com/google/caja/plugin/test-domado-events-guest.html
===================================================================
--- tests/com/google/caja/plugin/test-domado-events-guest.html (revision
5584)
+++ tests/com/google/caja/plugin/test-domado-events-guest.html (working
copy)
@@ -341,7 +341,6 @@
function testRepeatedHandlers() {
// an element containing the one being clicked on
var container = document.getElementById('testRepeatedHandlers');
-
var events = [];
var record = jsunitCallback(function(event) {
events.push([event.type, event.eventPhase]);
@@ -359,21 +358,12 @@
container.addEventListener('mousedown', record, false);
container.addEventListener('mousedown', function junk4() {}, false);
- container.addEventListener('mouseup', record, true);
- container.addEventListener('mouseup', function junk5() {}, true);
- container.addEventListener('mouseup', record, true);
-
- container.addEventListener('mouseup', function junk6() {}, false);
- container.addEventListener('mouseup', record, false);
- container.addEventListener('mouseup', record, false);
- container.addEventListener('mouseup', function junk7() {}, false);
-
var phase = 0;
var check = jsunitCallback(function(event) {
switch (++phase) {
case 1:
assertEquals(
- 'first', 'mousedown,1,mousedown,3,mouseup,1,mouseup,3',
+ 'first', 'mousedown,1,mousedown,3',
String(events));
events = [];
// remove one of the event listeners and check again
@@ -381,7 +371,7 @@
break;
case 2:
assertEquals(
- 'second', 'mousedown,1,mouseup,1,mouseup,3',
+ 'second', 'mousedown,1',
String(events));
events = [];
pass('testRepeatedHandlers');
@@ -392,8 +382,7 @@
break;
}
});
- container.addEventListener('mouseup', check, false);
-
+ container.addEventListener('mousedown', check, false);
});
</script>
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.