test(CssClass): verify that classes from string exp are cleared properly

Closes #2888
Closes #2934
This commit is contained in:
Pawel Kozlowski 2015-07-08 17:41:18 +02:00 committed by Tobias Bosch
parent 0792f1a7a1
commit bab271fcb4
1 changed files with 21 additions and 0 deletions

View File

@ -226,6 +226,27 @@ export function main() {
async.done(); async.done();
}); });
})); }));
it('should remove active classes when switching from string to null',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
var template = `<div [class]="strExpr"></div>`;
tcb.overrideTemplate(TestComponent, template)
.createAsync(TestComponent)
.then((rootTC) => {
rootTC.detectChanges();
expect(rootTC.componentViewChildren[0].nativeElement.className)
.toEqual('ng-binding foo');
rootTC.componentInstance.strExpr = null;
rootTC.detectChanges();
expect(rootTC.componentViewChildren[0].nativeElement.className)
.toEqual('ng-binding');
async.done();
});
}));
}); });
it('should remove active classes when expression evaluates to null', it('should remove active classes when expression evaluates to null',