@@ -15,8 +15,7 @@ import {
1515} from 'angular2/test_lib' ;
1616import { List , ListWrapper , StringMapWrapper } from 'angular2/src/facade/collection' ;
1717import { Component , View , NgFor , bind } from 'angular2/angular2' ;
18- import { DOM } from 'angular2/src/dom/dom_adapter' ;
19- import { CSSClass } from 'angular2/src/directives/class' ;
18+ import { NgClass } from 'angular2/src/directives/ng_class' ;
2019import { APP_VIEW_POOL_CAPACITY } from 'angular2/src/core/compiler/view_pool' ;
2120
2221export function main ( ) {
@@ -27,7 +26,7 @@ export function main() {
2726
2827 it ( 'should clean up when the directive is destroyed' ,
2928 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
30- var template = '<div *ng-for="var item of items" [class]="item"></div>' ;
29+ var template = '<div *ng-for="var item of items" [ng- class]="item"></div>' ;
3130 tcb . overrideTemplate ( TestComponent , template )
3231 . createAsync ( TestComponent )
3332 . then ( ( rootTC ) => {
@@ -48,7 +47,7 @@ export function main() {
4847
4948 it ( 'should add classes specified in an object literal' ,
5049 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
51- var template = '<div [class]="{foo: true, bar: false}"></div>' ;
50+ var template = '<div [ng- class]="{foo: true, bar: false}"></div>' ;
5251
5352 tcb . overrideTemplate ( TestComponent , template )
5453 . createAsync ( TestComponent )
@@ -64,7 +63,7 @@ export function main() {
6463
6564 it ( 'should add classes specified in an object literal without change in class names' ,
6665 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
67- var template = `<div [class]="{'foo-bar': true, 'fooBar': true}"></div>` ;
66+ var template = `<div [ng- class]="{'foo-bar': true, 'fooBar': true}"></div>` ;
6867
6968 tcb . overrideTemplate ( TestComponent , template )
7069 . createAsync ( TestComponent )
@@ -79,7 +78,7 @@ export function main() {
7978
8079 it ( 'should add and remove classes based on changes in object literal values' ,
8180 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
82- var template = '<div [class]="{foo: condition, bar: !condition}"></div>' ;
81+ var template = '<div [ng- class]="{foo: condition, bar: !condition}"></div>' ;
8382
8483 tcb . overrideTemplate ( TestComponent , template )
8584 . createAsync ( TestComponent )
@@ -99,7 +98,7 @@ export function main() {
9998
10099 it ( 'should add and remove classes based on changes to the expression object' ,
101100 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
102- var template = '<div [class]="objExpr"></div>' ;
101+ var template = '<div [ng- class]="objExpr"></div>' ;
103102
104103 tcb . overrideTemplate ( TestComponent , template )
105104 . createAsync ( TestComponent )
@@ -129,7 +128,7 @@ export function main() {
129128
130129 it ( 'should add and remove classes based on reference changes to the expression object' ,
131130 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
132- var template = '<div [class]="objExpr"></div>' ;
131+ var template = '<div [ng- class]="objExpr"></div>' ;
133132
134133 tcb . overrideTemplate ( TestComponent , template )
135134 . createAsync ( TestComponent )
@@ -157,7 +156,7 @@ export function main() {
157156
158157 it ( 'should add classes specified in a list literal' ,
159158 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
160- var template = `<div [class]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>` ;
159+ var template = `<div [ng- class]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>` ;
161160
162161 tcb . overrideTemplate ( TestComponent , template )
163162 . createAsync ( TestComponent )
@@ -172,7 +171,7 @@ export function main() {
172171
173172 it ( 'should add and remove classes based on changes to the expression' ,
174173 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
175- var template = '<div [class]="arrExpr"></div>' ;
174+ var template = '<div [ng- class]="arrExpr"></div>' ;
176175
177176 tcb . overrideTemplate ( TestComponent , template )
178177 . createAsync ( TestComponent )
@@ -205,7 +204,7 @@ export function main() {
205204
206205 it ( 'should add and remove classes when a reference changes' ,
207206 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
208- var template = '<div [class]="arrExpr"></div>' ;
207+ var template = '<div [ng- class]="arrExpr"></div>' ;
209208
210209 tcb . overrideTemplate ( TestComponent , template )
211210 . createAsync ( TestComponent )
@@ -228,7 +227,7 @@ export function main() {
228227
229228 it ( 'should add classes specified in a string literal' ,
230229 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
231- var template = `<div [class]="'foo bar foo-bar fooBar'"></div>` ;
230+ var template = `<div [ng- class]="'foo bar foo-bar fooBar'"></div>` ;
232231
233232 tcb . overrideTemplate ( TestComponent , template )
234233 . createAsync ( TestComponent )
@@ -243,7 +242,7 @@ export function main() {
243242
244243 it ( 'should add and remove classes based on changes to the expression' ,
245244 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
246- var template = '<div [class]="strExpr"></div>' ;
245+ var template = '<div [ng- class]="strExpr"></div>' ;
247246
248247 tcb . overrideTemplate ( TestComponent , template )
249248 . createAsync ( TestComponent )
@@ -269,7 +268,7 @@ export function main() {
269268
270269 it ( 'should remove active classes when switching from string to null' ,
271270 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
272- var template = `<div [class]="strExpr"></div>` ;
271+ var template = `<div [ng- class]="strExpr"></div>` ;
273272
274273 tcb . overrideTemplate ( TestComponent , template )
275274 . createAsync ( TestComponent )
@@ -290,7 +289,7 @@ export function main() {
290289
291290 it ( 'should remove active classes when expression evaluates to null' ,
292291 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
293- var template = '<div [class]="objExpr"></div>' ;
292+ var template = '<div [ng- class]="objExpr"></div>' ;
294293
295294 tcb . overrideTemplate ( TestComponent , template )
296295 . createAsync ( TestComponent )
@@ -313,25 +312,9 @@ export function main() {
313312 } ) ;
314313 } ) ) ;
315314
316- it ( 'should have no effect when activated by a static class attribute' ,
317- inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
318- var template = '<div class="init foo"></div>' ;
319-
320- tcb . overrideTemplate ( TestComponent , template )
321- . createAsync ( TestComponent )
322- . then ( ( rootTC ) => {
323- rootTC . detectChanges ( ) ;
324- // TODO(pk): in CJS className isn't initialized properly if we don't mutate classes
325- expect ( ListWrapper . join ( DOM . classList ( rootTC . componentViewChildren [ 0 ] . nativeElement ) ,
326- ' ' ) )
327- . toEqual ( 'init foo ng-binding' ) ;
328- async . done ( ) ;
329- } ) ;
330- } ) ) ;
331-
332315 it ( 'should co-operate with the class attribute' ,
333316 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
334- var template = '<div [class]="objExpr" class="init foo"></div>' ;
317+ var template = '<div [ng- class]="objExpr" class="init foo"></div>' ;
335318
336319 tcb . overrideTemplate ( TestComponent , template )
337320 . createAsync ( TestComponent )
@@ -352,7 +335,7 @@ export function main() {
352335
353336 it ( 'should co-operate with the class attribute and class.name binding' ,
354337 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
355- var template = '<div class="init foo" [class]="objExpr" [class.baz]="condition"></div>' ;
338+ var template = '<div class="init foo" [ng- class]="objExpr" [class.baz]="condition"></div>' ;
356339
357340 tcb . overrideTemplate ( TestComponent , template )
358341 . createAsync ( TestComponent )
@@ -383,7 +366,7 @@ export function main() {
383366}
384367
385368@Component ( { selector : 'test-cmp' } )
386- @View ( { directives : [ CSSClass , NgFor ] } )
369+ @View ( { directives : [ NgClass , NgFor ] } )
387370class TestComponent {
388371 condition : boolean = true ;
389372 items : any [ ] ;
0 commit comments