diff --git a/components/statistic/statistic.component.ts b/components/statistic/statistic.component.ts
index 92e2eb2a0b..fc295c8727 100644
--- a/components/statistic/statistic.component.ts
+++ b/components/statistic/statistic.component.ts
@@ -28,21 +28,23 @@ import { NzStatisticValueType } from './typings';
selector: 'nz-statistic',
exportAs: 'nzStatistic',
template: `
-
-
- {{ nzTitle }}
-
-
-
- {{ nzPrefix }}
-
-
-
- {{ nzSuffix }}
-
-
+
+ {{ nzTitle }}
- `
+
+
+ {{ nzPrefix }}
+
+
+
+ {{ nzSuffix }}
+
+
+ `,
+ host: {
+ class: 'ant-statistic',
+ '[class.ant-statistic-rtl]': `dir === 'rtl'`
+ }
})
export class NzStatisticComponent implements OnDestroy, OnInit {
@Input() nzPrefix?: string | TemplateRef
;
diff --git a/components/statistic/statistic.spec.ts b/components/statistic/statistic.spec.ts
index 07004ec0c4..8c9b12aeea 100644
--- a/components/statistic/statistic.spec.ts
+++ b/components/statistic/statistic.spec.ts
@@ -51,11 +51,11 @@ describe('nz-statistic', () => {
it('should className correct on dir change', () => {
fixture.detectChanges();
- expect(statisticEl.nativeElement.querySelector('.ant-statistic').classList).toContain('ant-statistic-rtl');
+ expect(statisticEl.nativeElement.classList).toContain('ant-statistic-rtl');
fixture.componentInstance.direction = 'ltr';
fixture.detectChanges();
- expect(statisticEl.nativeElement.querySelector('.ant-statistic').classList).not.toContain('ant-statistic-rtl');
+ expect(statisticEl.nativeElement.classList).not.toContain('ant-statistic-rtl');
});
});
});