diff --git a/modules/core/test/compiler/compiler_spec.js b/modules/core/test/compiler/compiler_spec.js index 968f92ad88..b44bdd786a 100644 --- a/modules/core/test/compiler/compiler_spec.js +++ b/modules/core/test/compiler/compiler_spec.js @@ -1,4 +1,4 @@ -import {describe, beforeEach, it, expect, ddescribe, iit} from 'test_lib/test_lib'; +import {describe, beforeEach, it, expect, ddescribe, iit, el} from 'test_lib/test_lib'; import {DOM} from 'facade/dom'; import {List} from 'facade/collection'; @@ -32,19 +32,19 @@ export function main() { var compiler = createCompiler( (parent, current, control) => { current.inheritedProtoView = rootProtoView; }); - compiler.compile(MainComponent, createElement('
')).then( (protoView) => { + compiler.compile(MainComponent, el('
')).then( (protoView) => { expect(protoView).toBe(rootProtoView); done(); }); }); it('should use the given element', (done) => { - var el = createElement('
'); + var element = el('
'); var compiler = createCompiler( (parent, current, control) => { current.inheritedProtoView = new ProtoView(current.element, null); }); - compiler.compile(MainComponent, el).then( (protoView) => { - expect(protoView.element).toBe(el); + compiler.compile(MainComponent, element).then( (protoView) => { + expect(protoView.element).toBe(element); done(); }); }); @@ -60,7 +60,7 @@ export function main() { }); it('should load nested components', (done) => { - var mainEl = createElement('
'); + var mainEl = el('
'); var compiler = createCompiler( (parent, current, control) => { current.inheritedProtoView = new ProtoView(current.element, null); current.inheritedElementBinder = current.inheritedProtoView.bindElement(null); @@ -77,14 +77,14 @@ export function main() { }); it('should cache components', (done) => { - var el = createElement('
'); + var element = el('
'); var compiler = createCompiler( (parent, current, control) => { current.inheritedProtoView = new ProtoView(current.element, null); }); var firstProtoView; - compiler.compile(MainComponent, el).then( (protoView) => { + compiler.compile(MainComponent, element).then( (protoView) => { firstProtoView = protoView; - return compiler.compile(MainComponent, el); + return compiler.compile(MainComponent, element); }).then( (protoView) => { expect(firstProtoView).toBe(protoView); done(); @@ -151,7 +151,3 @@ class MockStep extends CompileStep { this.processClosure(parent, current, control); } } - -function createElement(html) { - return DOM.createTemplate(html).content.firstChild; -} diff --git a/modules/core/test/compiler/integration_spec.js b/modules/core/test/compiler/integration_spec.js index 032a639690..7bb9fa9aac 100644 --- a/modules/core/test/compiler/integration_spec.js +++ b/modules/core/test/compiler/integration_spec.js @@ -1,4 +1,4 @@ -import {describe, xit, it, expect, beforeEach, ddescribe, iit} from 'test_lib/test_lib'; +import {describe, xit, it, expect, beforeEach, ddescribe, iit, el} from 'test_lib/test_lib'; import {DOM} from 'facade/dom'; @@ -33,7 +33,7 @@ export function main() { } it('should consume text node changes', (done) => { - compiler.compile(MyComp, createElement('
{{ctxProp}}
')).then((pv) => { + compiler.compile(MyComp, el('
{{ctxProp}}
')).then((pv) => { createView(pv); ctx.ctxProp = 'Hello World!'; @@ -44,7 +44,7 @@ export function main() { }); it('should consume element binding changes', (done) => { - compiler.compile(MyComp, createElement('
')).then((pv) => { + compiler.compile(MyComp, el('
')).then((pv) => { createView(pv); ctx.ctxProp = 'Hello World!'; @@ -56,7 +56,7 @@ export function main() { }); it('should consume directive watch expression change.', (done) => { - compiler.compile(MyComp, createElement('
')).then((pv) => { + compiler.compile(MyComp, el('
')).then((pv) => { createView(pv); ctx.ctxProp = 'Hello World!'; @@ -69,7 +69,7 @@ export function main() { }); it('should support nested components.', (done) => { - compiler.compile(MyComp, createElement('')).then((pv) => { + compiler.compile(MyComp, el('')).then((pv) => { createView(pv); cd.detectChanges(); @@ -80,7 +80,7 @@ export function main() { }); it('should support template directives via `