How do I test that the scope is populated after the broadcast? I\'ve searched and found a few QA\'s here in stackexchange, but none answered my problem. The code is working
If want to fake the returnValue
from $scope.$broadcast()
you can do something like these two cases:
Case 1:
scope.$broadcast('TEST_CHANGED', {test: 'test1'});
spyOn(scope, '$broadcast').and.callThrough();
expect(something).toEqual('something');
Case 2:
scope.$broadcast('TEST_CHANGED', {test: 'test2'});
spyOn(scope, '$broadcast').and.callThrough();
expect(something2).toEqual('something2');