Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/core_dom/transcluding_component_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {
var childInjectorCompleter; // Used if the ViewFuture is available before the childInjector.

var component = _component;
final shadowRoot = new EmulatedShadowRoot(element);
var lightDom = new LightDom(element, scope)..pullNodes();

final baseUrls = (_component.useNgBaseCss) ? baseCss.urls : [];
Expand All @@ -83,12 +84,12 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {
lightDom.clearComponentElement();
if (childInjector != null) {
lightDom.shadowDomView = viewFactory.call(childInjector.scope, childInjector);
return element;
return shadowRoot;
} else {
childInjectorCompleter = new async.Completer();
return childInjectorCompleter.future.then((childInjector) {
lightDom.shadowDomView = viewFactory.call(childInjector.scope, childInjector);
return element;
return shadowRoot;
});
}
});
Expand All @@ -103,7 +104,7 @@ class BoundTranscludingComponentFactory implements BoundComponentFactory {
Scope shadowScope = scope.createChild(new HashMap());

childInjector = new ComponentDirectiveInjector(injector, this._injector,
eventHandler, shadowScope, templateLoader, new EmulatedShadowRoot(element), lightDom, view);
eventHandler, shadowScope, templateLoader, shadowRoot, lightDom, view);

childInjector.bindByKey(_ref.typeKey, _ref.factory, _ref.paramKeys, _ref.annotation.visibility);

Expand Down
11 changes: 7 additions & 4 deletions test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,12 @@ void main() {
expect(logger).toEqual(expected);
logger.clear();

microLeap();
backend.flush();
microLeap();
expect(() {
microLeap();
backend.flush();
microLeap();
}).not.toThrow();

expect(logger).toEqual(['templateLoaded', _.rootScope.context['shadowRoot']]);
logger.clear();

Expand Down Expand Up @@ -1431,7 +1434,7 @@ class AttachDetachComponent implements AttachAware, DetachAware, ShadowRootAware

attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
detach() => logger('detach');
onShadowRoot(shadowRoot) {
onShadowRoot(ShadowRoot shadowRoot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the test, would it be possible to add a .not.toThrow() to make it more explicit ?

scope.rootScope.context['shadowRoot'] = shadowRoot;
logger(shadowRoot);
}
Expand Down