fix propogate/propagate typo in click handler. thanks to chris r. for finding this, elemoine for the review. (Closes #1359)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8207 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2008-10-27 19:00:08 +00:00
parent ad8201bed1
commit 84b65e5f8f
2 changed files with 40 additions and 1 deletions

View File

@@ -149,7 +149,7 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
if (this.checkModifiers(evt) && if (this.checkModifiers(evt) &&
this.control.handleRightClicks && this.control.handleRightClicks &&
OpenLayers.Event.isRightClick(evt)) { OpenLayers.Event.isRightClick(evt)) {
propogate = this.rightclick(evt); propagate = this.rightclick(evt);
} }
return propagate; return propagate;

View File

@@ -251,6 +251,45 @@
"deactivate sets timerId to null"); "deactivate sets timerId to null");
} }
function test_Handler_Click_mouseup(t) {
t.plan(4);
g_Propagate = {};
g_evt = {};
//no modifiers, no handlerightclicks, no isrightclick
var temp = OpenLayers.Event.isRightClick;
OpenLayers.Event.isRightClick = function(e) {
t.ok(e == g_evt, 'correct event passed in to checkModifiers');
return false;
};
var h = {
'checkModifiers': function(e) {
t.ok(e == g_evt, 'correct event passed in to checkModifiers');
return false;
},
'control': {
'handleRightClicks': false
},
'rightclick': function(e) {
t.ok(e == g_evt, 'correct event passed in to checkModifiers');
return g_Propagate;
}
};
var propagate = OpenLayers.Handler.Click.prototype.mouseup.apply(h, [g_evt]);
t.ok(propagate, "default propagate is true when no modifiers, no handlerightclicks, no isrightclick")
//modifiers, handlerightclicks, and isrightclick
h.checkModifiers = function() { return true; };
h.control.handleRightClicks = true;
OpenLayers.Event.isRightClick = function(e) { return true; };
propagate = OpenLayers.Handler.Click.prototype.mouseup.apply(h, [g_evt]);
t.ok(propagate == g_Propagate, "return from handler's rightClick() returned from mouseup");
OpenLayers.Event.isRightClick = temp;
}
</script> </script>
</head> </head>