@@ -218,6 +218,36 @@ export function main() {
218218 rootTC . debugElement . componentInstance . arrExpr = [ 'bar' ] ;
219219 detectChangesAndCheck ( rootTC , 'ng-binding foo bar' ) ;
220220
221+ async . done ( ) ;
222+ } ) ;
223+ } ) ) ;
224+
225+ it ( 'should ignore empty or blank class names' ,
226+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
227+ var template = '<div class="foo" [ng-class]="arrExpr"></div>' ;
228+
229+ tcb . overrideTemplate ( TestComponent , template )
230+ . createAsync ( TestComponent )
231+ . then ( ( rootTC ) => {
232+
233+ rootTC . debugElement . componentInstance . arrExpr = [ '' , ' ' ] ;
234+ detectChangesAndCheck ( rootTC , 'foo ng-binding' ) ;
235+
236+ async . done ( ) ;
237+ } ) ;
238+ } ) ) ;
239+
240+ it ( 'should trim blanks from class names' ,
241+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
242+ var template = '<div class="foo" [ng-class]="arrExpr"></div>' ;
243+
244+ tcb . overrideTemplate ( TestComponent , template )
245+ . createAsync ( TestComponent )
246+ . then ( ( rootTC ) => {
247+
248+ rootTC . debugElement . componentInstance . arrExpr = [ ' bar ' ] ;
249+ detectChangesAndCheck ( rootTC , 'foo ng-binding bar' ) ;
250+
221251 async . done ( ) ;
222252 } ) ;
223253 } ) ) ;
@@ -289,6 +319,20 @@ export function main() {
289319 } ) ;
290320 } ) ) ;
291321
322+ it ( 'should ignore empty and blank strings' ,
323+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
324+ var template = `<div class="foo" [ng-class]="strExpr"></div>` ;
325+
326+ tcb . overrideTemplate ( TestComponent , template )
327+ . createAsync ( TestComponent )
328+ . then ( ( rootTC ) => {
329+ rootTC . debugElement . componentInstance . strExpr = '' ;
330+ detectChangesAndCheck ( rootTC , 'foo ng-binding' ) ;
331+
332+ async . done ( ) ;
333+ } ) ;
334+ } ) ) ;
335+
292336 } ) ;
293337
294338 describe ( 'cooperation with other class-changing constructs' , ( ) => {
0 commit comments