diff --git a/modules/angular2/test/core/compiler/query_integration_spec.ts b/modules/angular2/test/core/compiler/query_integration_spec.ts
index 63920aabe0..255ad25331 100644
--- a/modules/angular2/test/core/compiler/query_integration_spec.ts
+++ b/modules/angular2/test/core/compiler/query_integration_spec.ts
@@ -349,6 +349,22 @@ export function main() {
expect(asNativeElements(view.componentViewChildren)).toHaveText('hello|world|');
+ async.done();
+ });
+ }));
+
+ it('should support querying the view by using a view query',
+ inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
+ var template = '';
+
+ tcb.overrideTemplate(MyComp, template)
+ .createAsync(MyComp)
+ .then((view) => {
+ var q: NeedsViewQueryByLabel = view.componentViewChildren[0].getLocal("q");
+ view.detectChanges();
+
+ expect(q.query.first.nativeElement).toHaveText("text");
+
async.done();
});
}));
@@ -545,6 +561,16 @@ class NeedsQueryByLabel {
}
}
+@Component({selector: 'needs-view-query-by-var-binding'})
+@View({directives: [], template: '
text
'})
+@Injectable()
+class NeedsViewQueryByLabel {
+ query: QueryList;
+ constructor(@ViewQuery("textLabel", {descendants: true}) query: QueryList) {
+ this.query = query;
+ }
+}
+
@Component({selector: 'needs-query-by-var-bindings'})
@View({directives: [], template: ''})
@Injectable()
@@ -665,6 +691,7 @@ class NeedsTpl {
NeedsViewQueryIf,
NeedsViewQueryNestedIf,
NeedsViewQueryOrder,
+ NeedsViewQueryByLabel,
NeedsTpl,
TextDirective,
InertDirective,