@@ -19,12 +19,12 @@ import {TestBed} from 'angular2/src/test_lib/test_bed';
1919import { Component } from 'angular2/src/core/annotations_impl/annotations' ;
2020import { View } from 'angular2/src/core/annotations_impl/view' ;
2121
22- import { If } from 'angular2/src/directives/if ' ;
22+ import { NgIf } from 'angular2/src/directives/ng_if ' ;
2323
2424export function main ( ) {
2525 describe ( 'if directive' , ( ) => {
2626 it ( 'should work in a template attribute' , inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
27- var html = '<div><copy-me template="if booleanCondition">hello</copy-me></div>' ;
27+ var html = '<div><copy-me template="ng- if booleanCondition">hello</copy-me></div>' ;
2828
2929 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
3030 view . detectChanges ( ) ;
@@ -35,7 +35,7 @@ export function main() {
3535 } ) ) ;
3636
3737 it ( 'should work in a template element' , inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
38- var html = '<div><template [if]="booleanCondition"><copy-me>hello2</copy-me></template></div>' ;
38+ var html = '<div><template [ng- if]="booleanCondition"><copy-me>hello2</copy-me></template></div>' ;
3939
4040 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
4141 view . detectChanges ( ) ;
@@ -46,7 +46,7 @@ export function main() {
4646 } ) ) ;
4747
4848 it ( 'should toggle node when condition changes' , inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
49- var html = '<div><copy-me template="if booleanCondition">hello</copy-me></div>' ;
49+ var html = '<div><copy-me template="ng- if booleanCondition">hello</copy-me></div>' ;
5050
5151 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
5252 view . context . booleanCondition = false ;
@@ -69,7 +69,7 @@ export function main() {
6969 } ) ) ;
7070
7171 it ( 'should handle nested if correctly' , inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
72- var html = '<div><template [if]="booleanCondition"><copy-me *if="nestedBooleanCondition">hello</copy-me></template></div>' ;
72+ var html = '<div><template [ng- if]="booleanCondition"><copy-me *ng- if="nestedBooleanCondition">hello</copy-me></template></div>' ;
7373
7474 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
7575 view . context . booleanCondition = false ;
@@ -104,9 +104,9 @@ export function main() {
104104 it ( 'should update several nodes with if' , inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
105105 var html =
106106 '<div>' +
107- '<copy-me template="if numberCondition + 1 >= 2">helloNumber</copy-me>' +
108- '<copy-me template="if stringCondition == \'foo\'">helloString</copy-me>' +
109- '<copy-me template="if functionCondition(stringCondition, numberCondition)">helloFunction</copy-me>' +
107+ '<copy-me template="ng- if numberCondition + 1 >= 2">helloNumber</copy-me>' +
108+ '<copy-me template="ng- if stringCondition == \'foo\'">helloString</copy-me>' +
109+ '<copy-me template="ng- if functionCondition(stringCondition, numberCondition)">helloFunction</copy-me>' +
110110 '</div>' ;
111111
112112 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
@@ -132,7 +132,7 @@ export function main() {
132132 if ( ! IS_DARTIUM ) {
133133 it ( 'should not add the element twice if the condition goes from true to true (JS)' ,
134134 inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
135- var html = '<div><copy-me template="if numberCondition">hello</copy-me></div>' ;
135+ var html = '<div><copy-me template="ng- if numberCondition">hello</copy-me></div>' ;
136136
137137 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
138138 view . detectChanges ( ) ;
@@ -150,7 +150,7 @@ export function main() {
150150
151151 it ( 'should not recreate the element if the condition goes from true to true (JS)' ,
152152 inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
153- var html = '<div><copy-me template="if numberCondition">hello</copy-me></div>' ;
153+ var html = '<div><copy-me template="ng- if numberCondition">hello</copy-me></div>' ;
154154
155155 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
156156 view . detectChanges ( ) ;
@@ -168,7 +168,7 @@ export function main() {
168168 if ( IS_DARTIUM ) {
169169 it ( 'should not create the element if the condition is not a boolean (DART)' ,
170170 inject ( [ TestBed , AsyncTestCompleter ] , ( tb , async ) => {
171- var html = '<div><copy-me template="if numberCondition">hello</copy-me></div>' ;
171+ var html = '<div><copy-me template="ng- if numberCondition">hello</copy-me></div>' ;
172172
173173 tb . createView ( TestComponent , { html : html } ) . then ( ( view ) => {
174174 expect ( ( ) => view . detectChanges ( ) ) . toThrowError ( ) ;
@@ -183,7 +183,7 @@ export function main() {
183183}
184184
185185@Component ( { selector : 'test-cmp' } )
186- @View ( { directives : [ If ] } )
186+ @View ( { directives : [ NgIf ] } )
187187class TestComponent {
188188 booleanCondition : boolean ;
189189 nestedBooleanCondition : boolean ;
0 commit comments