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

Commit f1bb847

Browse files
committed
chore(compiler): Added a failing test for ng-repeat, fixup ng-shadow-dom
1 parent 35b6b0f commit f1bb847

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/directives/ng_shadow_dom.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
part of angular;
22

33
class NgShadowDomAttrDirective {
4+
Block block;
45
NgShadowDomAttrDirective(BlockList list, dom.Element element) {
5-
var block = list.newBlock();
6+
block = list.newBlock();
67
var shadowRoot = element.createShadowRoot();
78
for (var i = 0, ii = block.elements.length; i < ii; i++) {
89
shadowRoot.append(block.elements[i]);
910
}
1011
}
1112

12-
attach(Scope scope) {}
13+
attach(Scope scope) {
14+
block.attach(scope);
15+
}
1316
}

test/compiler_spec.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ main() {
6363
expect(element.html()).toEqual('<!--ANCHOR: ng-repeat=item in items-->');
6464
}));
6565

66+
xit('should compile repeater with children', inject(() {
67+
var element = $('<div><div ng-repeat="item in items"><div ng-bind="item"></div></div></div>');
68+
var template = $compile(element);
69+
70+
$rootScope.items = ['A', 'b'];
71+
template(element).attach($rootScope);
72+
73+
expect(element.text()).toEqual('');
74+
// TODO(deboer): Digest twice until we have dirty checking in the scope.
75+
$rootScope.$digest();
76+
$rootScope.$digest();
77+
expect(element.text()).toEqual('Ab');
78+
79+
$rootScope.items = [];
80+
$rootScope.$digest();
81+
expect(element.html()).toEqual('<!--ANCHOR: ng-repeat=item in items-->');
82+
}));
83+
6684

6785
xit('should compile multi-root repeater', inject(() {
6886
var element = $(

0 commit comments

Comments
 (0)