diff options
| author | Matthieu Larcher | 2013-05-02 21:12:00 +0200 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-05-03 19:55:47 +0100 |
| commit | af0eaa304748f330739a4b0aadb13201126c5407 (patch) | |
| tree | b6780f190feab2e12ba2eabd292f9290ead78900 /test/ng/directive/ngIncludeSpec.js | |
| parent | a348e90aa141921b914f87ec930cd6ebf481a446 (diff) | |
| download | angular.js-af0eaa304748f330739a4b0aadb13201126c5407.tar.bz2 | |
feat(ngInclude): $includeContentRequested event
Adding a $includeContentRequested event in order to better keep track of
how many includes are sent and be able to compare it with how many have
finished.
Diffstat (limited to 'test/ng/directive/ngIncludeSpec.js')
| -rw-r--r-- | test/ng/directive/ngIncludeSpec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ng/directive/ngIncludeSpec.js b/test/ng/directive/ngIncludeSpec.js index a990a840..1ce55bb4 100644 --- a/test/ng/directive/ngIncludeSpec.js +++ b/test/ng/directive/ngIncludeSpec.js @@ -59,6 +59,22 @@ describe('ngInclude', function() { expect(element.text()).toEqual(''); })); + it('should fire $includeContentRequested event on scope after making the xhr call', inject( + function ($rootScope, $compile, $httpBackend) { + var contentRequestedSpy = jasmine.createSpy('content requested').andCallFake(function (event) { + expect(event.targetScope).toBe($rootScope); + }); + + $httpBackend.whenGET('url').respond('my partial'); + $rootScope.$on('$includeContentRequested', contentRequestedSpy); + + element = $compile('<ng:include src="\'url\'"></ng:include>')($rootScope); + $rootScope.$digest(); + + expect(contentRequestedSpy).toHaveBeenCalledOnce(); + + $httpBackend.flush(); + })); it('should fire $includeContentLoaded event on child scope after linking the content', inject( function($rootScope, $compile, $templateCache) { |
