Skip to content

Commit

Permalink
MediaDisplayObject's notify emits "end"
Browse files Browse the repository at this point in the history
  • Loading branch information
basecode committed Sep 27, 2013
1 parent 03b86f8 commit 22ce3e0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runner/media_display_object.js
Expand Up @@ -110,7 +110,11 @@ define([
case 'error':
// We trigger the event asynchronously so as to ensure that any events
// bound after instantiation are still triggered:
this.emitAsync('error', Error(data.error));
this.emitAsync('error', new Error(data.error));
break;
case 'end':
this.emit('end', this);
break;
}

return this;
Expand Down
14 changes: 14 additions & 0 deletions test/media_display_object-spec.js
Expand Up @@ -68,6 +68,20 @@ require([
});
});

describe('notify', function() {
it('returns the current instance', function() {
var mediaDisplayObject = new MediaDisplayObject();
expect(mediaDisplayObject.notify()).toBe(mediaDisplayObject);
});
it('emits "end" on type=end', function() {
var mediaDisplayObject = new MediaDisplayObject();
var endSpy = jasmine.createSpy('end');
mediaDisplayObject.on('end', endSpy);
mediaDisplayObject.notify('end');
expect(endSpy).toHaveBeenCalledWith(mediaDisplayObject);
});
});

});

});
Expand Down

0 comments on commit 22ce3e0

Please sign in to comment.