From 167b4909fca4c72a903ccc695043f6a13d1a4b98 Mon Sep 17 00:00:00 2001 From: James deBoer Date: Mon, 17 Mar 2014 10:06:46 -0700 Subject: [PATCH] fix(tagging compiler): Sibling templates --- lib/core_dom/tagging_compiler.dart | 2 +- lib/directive/ng_repeat.dart | 1 + test/core_dom/compiler_spec.dart | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/core_dom/tagging_compiler.dart b/lib/core_dom/tagging_compiler.dart index 522cbd24b..6d9f5b42b 100644 --- a/lib/core_dom/tagging_compiler.dart +++ b/lib/core_dom/tagging_compiler.dart @@ -91,7 +91,7 @@ class TaggingCompiler implements Compiler { (templateCursor.current.parentNode as dom.Element).classes.add('ng-binding'); } directParentElementBinder.addText( - new TaggedTextBinder(elementBinder, 0 /* TODO */)); + new TaggedTextBinder(elementBinder, domCursor.index)); } else if(!(node.parentNode != null && templateCursor.current.parentNode != null)) { // Always add an elementBinder for top-level text. diff --git a/lib/directive/ng_repeat.dart b/lib/directive/ng_repeat.dart index 6510c6355..087900be9 100644 --- a/lib/directive/ng_repeat.dart +++ b/lib/directive/ng_repeat.dart @@ -105,6 +105,7 @@ class NgRepeatDirective { this.filters); set expression(value) { + assert(value != null); _expression = value; if (_watch != null) _watch.remove(); Match match = _SYNTAX.firstMatch(_expression); diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index 80bc34c05..2422a2582 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -108,6 +108,17 @@ void main() { ''); }); + it('should compile a sibling template directive', () { + var element = $(_.compile( + '
' + '' + '
{{value}}
' + '
')); + + _.rootScope.apply(); + expect(element.text()).toEqual('blank12'); + }); + it('should compile repeater with children', inject((Compiler $compile) { var element = $(_.compile('
'));