From b5c9f9ed9bc9c3f10668afee3bffe7c5188c4457 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Mon, 13 Apr 2015 09:35:24 -0700 Subject: [PATCH] cleanup(element_injector): added a missing test --- .../test/core/compiler/element_injector_spec.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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(() => {