diff --git a/modules/@angular/common/test/directives/ng_plural_spec.ts b/modules/@angular/common/test/directives/ng_plural_spec.ts index 7c45753289..cf869acf74 100644 --- a/modules/@angular/common/test/directives/ng_plural_spec.ts +++ b/modules/@angular/common/test/directives/ng_plural_spec.ts @@ -34,6 +34,31 @@ export function main() { }); })); + it('should be applicable to elements', + inject( + [TestComponentBuilder, AsyncTestCompleter], + (tcb: TestComponentBuilder, async: AsyncTestCompleter) => { + var template = '
' + + '' + + '' + + '' + + '
'; + + tcb.overrideTemplate(TestComponent, template) + .createAsync(TestComponent) + .then((fixture) => { + fixture.debugElement.componentInstance.switchValue = 0; + fixture.detectChanges(); + expect(fixture.debugElement.nativeElement).toHaveText('you have no messages.'); + + fixture.debugElement.componentInstance.switchValue = 1; + fixture.detectChanges(); + expect(fixture.debugElement.nativeElement).toHaveText('you have one message.'); + + async.done(); + }); + })); + it('should display the template according to the category', inject( [TestComponentBuilder, AsyncTestCompleter], @@ -124,9 +149,7 @@ export class TestLocalizationMap extends NgLocalization { } -@Component({selector: 'test-cmp', directives: [NgPlural, NgPluralCase], template: ''}) +@Component({selector: 'test-cmp', directives: [NgPluralCase, NgPlural], template: ''}) class TestComponent { - switchValue: number; - - constructor() { this.switchValue = null; } + switchValue: number = null; } diff --git a/modules/@angular/compiler/src/i18n/expander.ts b/modules/@angular/compiler/src/i18n/expander.ts index c7bd450cac..86ec0bb5ca 100644 --- a/modules/@angular/compiler/src/i18n/expander.ts +++ b/modules/@angular/compiler/src/i18n/expander.ts @@ -22,17 +22,16 @@ const PLURAL_CASES: string[] = ['zero', 'one', 'two', 'few', 'many', 'other']; * will be expanded into * * ``` - * + * + *