Permalink
Browse files

fix(ContentChild): query descendants by default

fixes #1645
  • Loading branch information...
vicb authored and alexeagle committed Sep 16, 2016
1 parent cba885a commit 0dc15eb64ac268e115c484319941ba11ce09d596
@@ -275,7 +275,7 @@ export const ContentChild: ContentChildDecorator = makePropDecorator(
['selector', undefined], {
first: true,
isViewQuery: false,
- descendants: false,
+ descendants: true,
read: undefined,
}
],
@@ -250,6 +250,17 @@ export function main() {
expect(comp.textDirChild.text).toEqual('ca');
});
+ it('should contain the first descendant content child', () => {
+ const template = '<needs-content-child-read>' +
+ '<div dir><div #q text="ca"></div></div>' +
+ '</needs-content-child-read>';
+ const view = createTestCmpAndDetectChanges(MyComp0, template);
+
+ const comp: NeedsContentChildWithRead =
+ view.debugElement.children[0].injector.get(NeedsContentChildWithRead);
+ expect(comp.textDirChild.text).toEqual('ca');
+ });
+
it('should contain the first view child', () => {
const template = '<needs-view-child-read></needs-view-child-read>';
const view = createTestCmpAndDetectChanges(MyComp0, template);
@@ -20,10 +20,10 @@ export declare class ComponentFixture<T> {
}
/** @experimental */
-export declare var ComponentFixtureAutoDetect: OpaqueToken;
+export declare const ComponentFixtureAutoDetect: OpaqueToken;
/** @experimental */
-export declare var ComponentFixtureNoNgZone: OpaqueToken;
+export declare const ComponentFixtureNoNgZone: OpaqueToken;
/** @experimental */
export declare function discardPeriodicTasks(): void;

3 comments on commit 0dc15eb

@lacolaco

This comment has been minimized.

Show comment
Hide comment
@lacolaco

lacolaco Sep 23, 2016

Contributor

@vicb This commit should be related to #11645

Opened. #11871

Contributor

lacolaco replied Sep 23, 2016

@vicb This commit should be related to #11645

Opened. #11871

@vicb

This comment has been minimized.

Show comment
Hide comment
@vicb

vicb Sep 23, 2016

Member

thanks

Member

vicb replied Sep 23, 2016

thanks

@cagataycivici

This comment has been minimized.

Show comment
Hide comment
@cagataycivici

cagataycivici Nov 21, 2016

Isn't this inconsistent to @ContentChildren, which does not query descendants.

Isn't this inconsistent to @ContentChildren, which does not query descendants.

Please sign in to comment.