Permalink
Browse files

Make goog.events.testing.mixinListenable also mixin

goog.Disposable stuff, so that it can be disposed correctly.

R=nicksantos
DELTA=8 (7 added, 0 deleted, 1 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6262


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2509 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent efe164e commit 8403b0016559da6d59f50f26a444ceeefb7cc55b chrishenry@google.com committed Feb 5, 2013
Showing with 8 additions and 1 deletion.
  1. +3 −1 closure/goog/testing/events/events.js
  2. +5 −0 closure/goog/testing/events/events_test.html
@@ -674,8 +674,10 @@ goog.testing.events.mixinListenable = function(obj) {
listenable.setTargetForTesting(obj);
var listenablePrototype = goog.events.EventTarget.prototype;
+ var disposablePrototype = goog.Disposable.prototype;
for (var key in listenablePrototype) {
- if (listenablePrototype.hasOwnProperty(key)) {
+ if (listenablePrototype.hasOwnProperty(key) ||
+ disposablePrototype.hasOwnProperty(key)) {
var member = listenablePrototype[key];
if (goog.isFunction(member)) {
obj[key] = goog.bind(member, listenable);
@@ -584,6 +584,11 @@
goog.events.unlisten(obj, 'test', handler);
obj.dispatchEvent('test');
assertEquals(1, handler.getCallCount());
+
+ goog.events.listen(obj, 'test', handler);
+ obj.dispose();
+ obj.dispatchEvent('test');
+ assertEquals(1, handler.getCallCount());
}
function testMixinListenableLegacy() {

0 comments on commit 8403b00

Please sign in to comment.