Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(ng-repeat): should correctly handle detached state
Browse files Browse the repository at this point in the history
Closes #697
  • Loading branch information
pavelgj authored and mhevery committed Mar 13, 2014
1 parent 9354924 commit 775bbce
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions test/directive/ng_repeat_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ main() {
beforeEach(inject((Injector injector, Scope $rootScope, Compiler compiler, DirectiveMap _directives) {
$exceptionHandler = injector.get(ExceptionHandler);
scope = $rootScope;
$compile = (html) {
$compile = (html, [scope]) {
element = $(html);
var viewFactory = compiler(element, _directives);
var view = viewFactory(injector, element);
var blockInjector = injector;
if (scope != null) {
viewFactory.bind(injector)(scope);
} else {
viewFactory(injector, element);
}
return element;
};
directives = _directives;
Expand Down Expand Up @@ -404,5 +409,19 @@ main() {
});
});


it('should correctly handle detached state', () {
scope.context['items'] = [1];

var parentScope = scope.createChild(new PrototypeMap(scope.context));
element = $compile(
'<ul>' +
'<li ng-repeat="item in items">{{item}}</li>' +
'</ul>', parentScope);

parentScope.destroy();
expect(scope.apply).not.toThrow();
});

});
}

0 comments on commit 775bbce

Please sign in to comment.