Skip to content

Commit

Permalink
refactor(NgIf): replace createElement() by el()
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jan 23, 2015
1 parent 3b34ef4 commit be6ce02
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions modules/directives/test/ng_if_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, xit, it, expect, beforeEach, ddescribe, iit, IS_DARTIUM} from 'test_lib/test_lib';
import {describe, xit, it, expect, beforeEach, ddescribe, iit, IS_DARTIUM, el} from 'test_lib/test_lib';

import {DOM} from 'facade/dom';

Expand All @@ -20,10 +20,6 @@ export function main() {
compiler = new Compiler(null, new DirectiveMetadataReader(), new Parser(new Lexer()), new CompilerCache());
});

function createElement(html) {
return DOM.createTemplate(html).content.firstChild;
}

function createView(pv) {
component = new TestComponent();
view = pv.instantiate(null);
Expand All @@ -32,7 +28,7 @@ export function main() {
}

function compileWithTemplate(template) {
return compiler.compile(TestComponent, createElement(template));
return compiler.compile(TestComponent, el(template));
}

it('should work in a template attribute', (done) => {
Expand Down Expand Up @@ -60,7 +56,7 @@ export function main() {
it('should toggle node when condition changes', (done) => {
compileWithTemplate('<div><copy-me template="ng-if booleanCondition">hello</copy-me></div>').then((pv) => {
createView(pv);

component.booleanCondition = false;
cd.detectChanges();
expect(view.nodes[0].querySelectorAll('copy-me').length).toEqual(0);
Expand Down Expand Up @@ -109,7 +105,7 @@ export function main() {
});
});


if (!IS_DARTIUM) {
it('should leave the element if the condition is a non-empty string (JS)', (done) => {
compileWithTemplate('<div><copy-me template="ng-if stringCondition">hello</copy-me></div>').then((pv) => {
Expand Down

0 comments on commit be6ce02

Please sign in to comment.