From bab271fcb46f8df8ddd600feda65d6dad27d0007 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Wed, 8 Jul 2015 17:41:18 +0200 Subject: [PATCH] test(CssClass): verify that classes from string exp are cleared properly Closes #2888 Closes #2934 --- .../angular2/test/directives/class_spec.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/angular2/test/directives/class_spec.ts b/modules/angular2/test/directives/class_spec.ts index 9cb281d676..f616d034fc 100644 --- a/modules/angular2/test/directives/class_spec.ts +++ b/modules/angular2/test/directives/class_spec.ts @@ -226,6 +226,27 @@ export function main() { async.done(); }); })); + + + it('should remove active classes when switching from string to null', + inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { + var template = `
`; + + 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',