Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 66f077c

Browse files
committed
update test to use jasmine spy #8454
1 parent 1b1c3dc commit 66f077c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

test/ng/directive/ngIncludeSpec.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,12 @@ describe('ngInclude', function() {
361361
}));
362362

363363
it('should fire $includeContentLoaded with the template url as the second parameter', inject(function($rootScope, $compile, $templateCache) {
364-
var called = 0;
364+
var handlerSpy = jasmine.createSpy('handler');
365365
$templateCache.put('/some/template.html', [200, '', {}]);
366-
$rootScope.$on('$includeContentLoaded', function(event, src) {
367-
expect(src).toBe('/some/template.html');
368-
called++;
369-
});
366+
$rootScope.$on('$includeContentLoaded', handlerSpy);
370367
element = $compile('<div><ng:include src="\'/some/template.html\'"></ng:include></div>')($rootScope);
371368
$rootScope.$digest();
372-
expect(called).toBe(1);
369+
expect(handlerSpy).toHaveBeenCalledWith(jasmine.any(Object), '/some/template.html');
373370
}));
374371

375372
describe('autoscroll', function() {

0 commit comments

Comments
 (0)