aboutsummaryrefslogtreecommitdiffstats
path: root/test/service
diff options
context:
space:
mode:
authorVojta Jina2012-02-16 22:22:06 -0800
committerVojta Jina2012-02-21 10:58:48 -0800
commit6e635012fb30905e5fe659a024864e275f1c14b5 (patch)
treed6ef5f72b89a374d0af58d547f5cd843156332ab /test/service
parenteb92735c9ea3e5ddc747b66d8e895b6187a5f9e0 (diff)
downloadangular.js-6e635012fb30905e5fe659a024864e275f1c14b5.tar.bz2
feat(scope): scope.$emit/$broadcast return the event object, add cancelled property
Diffstat (limited to 'test/service')
-rw-r--r--test/service/scopeSpec.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/service/scopeSpec.js b/test/service/scopeSpec.js
index cc3f93f5..c3a09cc8 100644
--- a/test/service/scopeSpec.js
+++ b/test/service/scopeSpec.js
@@ -658,6 +658,18 @@ describe('Scope', function() {
child.$emit('abc', 'arg1', 'arg2');
});
+
+ it('should return event object with cancelled property', function() {
+ child.$on('some', function(event) {
+ event.cancel();
+ });
+
+ var result = grandChild.$emit('some');
+ expect(result).toBeDefined();
+ expect(result.cancelled).toBe(true);
+ });
+
+
describe('event object', function() {
it('should have methods/properties', function() {
var event;
@@ -752,6 +764,15 @@ describe('Scope', function() {
$rootScope.$broadcast('fooEvent');
expect(log).toBe('');
}));
+
+
+ it('should return event object', function() {
+ var result = child1.$broadcast('some');
+
+ expect(result).toBeDefined();
+ expect(result.name).toBe('some');
+ expect(result.targetScope).toBe(child1);
+ });
});