diff --git a/modules/angular2/test/core/compiler/element_injector_spec.js b/modules/angular2/test/core/compiler/element_injector_spec.js index 8c6fee2ef8..78beabf87e 100644 --- a/modules/angular2/test/core/compiler/element_injector_spec.js +++ b/modules/angular2/test/core/compiler/element_injector_spec.js @@ -1,7 +1,8 @@ import {describe, ddescribe, it, iit, xit, xdescribe, expect, beforeEach, SpyObject, proxy, el} from 'angular2/test_lib'; import {isBlank, isPresent, IMPLEMENTS} from 'angular2/src/facade/lang'; import {ListWrapper, MapWrapper, List, StringMapWrapper, iterateListLike} from 'angular2/src/facade/collection'; -import {ProtoElementInjector, PreBuiltObjects, DirectiveBinding, TreeNode} from 'angular2/src/core/compiler/element_injector'; +import {ProtoElementInjector, PreBuiltObjects, DirectiveBinding, TreeNode, ElementRef} + from 'angular2/src/core/compiler/element_injector'; import {Parent, Ancestor} from 'angular2/src/core/annotations/visibility'; import {EventEmitter, PropertySetter, Attribute, Query} from 'angular2/src/core/annotations/di'; import {onDestroy} from 'angular2/src/core/annotations/annotations'; @@ -169,6 +170,13 @@ class NeedsQuery { } } +class NeedsElementRef { + elementRef; + constructor(ref:ElementRef) { + this.elementRef = ref; + } +} + class A_Needs_B { constructor(dep){} } @@ -802,6 +810,13 @@ export function main() { }); }); + describe("ElementRef", () => { + it("should inject ElementRef", () => { + var inj = injector([NeedsElementRef]); + expect(inj.get(NeedsElementRef).elementRef).toBeAnInstanceOf(ElementRef); + }); + }); + describe('directive queries', () => { var preBuildObjects = defaultPreBuiltObjects; beforeEach(() => {