aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/ngRepeatSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive/ngRepeatSpec.js')
-rw-r--r--test/ng/directive/ngRepeatSpec.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js
index 6584f31a..bdc0b8f5 100644
--- a/test/ng/directive/ngRepeatSpec.js
+++ b/test/ng/directive/ngRepeatSpec.js
@@ -749,8 +749,30 @@ describe('ngRepeat', function() {
expect(element.text()).toBe('123');
}));
}
- });
+ it('should work when combined with an ASYNC template that loads after the first digest', inject(function($httpBackend, $compile, $rootScope) {
+ $compileProvider.directive('test', function() {
+ return {
+ templateUrl: 'test.html'
+ };
+ });
+ $httpBackend.whenGET('test.html').respond('hello');
+ element = jqLite('<div><div ng-repeat="i in items" test></div></div>');
+ $compile(element)($rootScope);
+ $rootScope.items = [1];
+ $rootScope.$apply();
+ expect(element.text()).toBe('');
+
+ $httpBackend.flush();
+ expect(element.text()).toBe('hello');
+
+ $rootScope.items = [];
+ $rootScope.$apply();
+ // Note: there are still comments in element!
+ expect(element.children().length).toBe(0);
+ expect(element.text()).toBe('');
+ }));
+ });
it('should add separator comments after each item', inject(function ($compile, $rootScope) {
var check = function () {