diff --git a/lib/core_dom/transcluding_component_factory.dart b/lib/core_dom/transcluding_component_factory.dart index 008286c34..f5732c512 100644 --- a/lib/core_dom/transcluding_component_factory.dart +++ b/lib/core_dom/transcluding_component_factory.dart @@ -52,7 +52,7 @@ class ContentPort { var next; for (next = _beginComment.nextNode; - next.nodeType != dom.Node.COMMENT_NODE && next.text != endCommentText; + next.nodeType != dom.Node.COMMENT_NODE || next.text != endCommentText; next = _beginComment.nextNode) { _childNodes.add(next); next.remove(); diff --git a/test/core_dom/compiler_spec.dart b/test/core_dom/compiler_spec.dart index c8e48cd28..ed80c18af 100644 --- a/test/core_dom/compiler_spec.dart +++ b/test/core_dom/compiler_spec.dart @@ -19,6 +19,10 @@ forBothCompilers(fn) { }); fn(); }); +} + +forAllCompilersAndComponentFactories(fn) { + forBothCompilers(fn); describe('transcluding components', () { beforeEachModule((Module m) { @@ -33,6 +37,29 @@ forBothCompilers(fn) { void main() { forBothCompilers(() => + describe('TranscludingComponentFactory', () { + TestBed _; + + beforeEachModule((Module m) { + return m + ..bind(ComponentFactory, toImplementation: TranscludingComponentFactory) + ..bind(SimpleComponent); + }); + + beforeEach(inject((TestBed tb) => _ = tb)); + + it('should correctly detach transcluded content when scope destroyed', async(() { + var scope = _.rootScope.createChild({}); + var element = _.compile(r'
trans
', scope: scope); + microLeap(); + _.rootScope.apply(); + expect(element).toHaveText('INNER(trans)'); + scope.destroy(); + expect(element).toHaveText('INNER()'); + })); + })); + + forAllCompilersAndComponentFactories(() => describe('dte.compiler', () { TestBed _;