Skip to content

Commit

Permalink
fix(module:statistic): remove top-level redundant div element (#7659)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 committed Oct 9, 2022
1 parent 2dcefe2 commit 07df410
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
30 changes: 16 additions & 14 deletions components/statistic/statistic.component.ts
Expand Up @@ -28,21 +28,23 @@ import { NzStatisticValueType } from './typings';
selector: 'nz-statistic',
exportAs: 'nzStatistic',
template: `
<div class="ant-statistic" [class.ant-statistic-rtl]="dir === 'rtl'">
<div class="ant-statistic-title">
<ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
</div>
<div class="ant-statistic-content" [ngStyle]="nzValueStyle">
<span *ngIf="nzPrefix" class="ant-statistic-content-prefix">
<ng-container *nzStringTemplateOutlet="nzPrefix">{{ nzPrefix }}</ng-container>
</span>
<nz-statistic-number [nzValue]="nzValue" [nzValueTemplate]="nzValueTemplate"></nz-statistic-number>
<span *ngIf="nzSuffix" class="ant-statistic-content-suffix">
<ng-container *nzStringTemplateOutlet="nzSuffix">{{ nzSuffix }}</ng-container>
</span>
</div>
<div class="ant-statistic-title">
<ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
</div>
`
<div class="ant-statistic-content" [ngStyle]="nzValueStyle">
<span *ngIf="nzPrefix" class="ant-statistic-content-prefix">
<ng-container *nzStringTemplateOutlet="nzPrefix">{{ nzPrefix }}</ng-container>
</span>
<nz-statistic-number [nzValue]="nzValue" [nzValueTemplate]="nzValueTemplate"></nz-statistic-number>
<span *ngIf="nzSuffix" class="ant-statistic-content-suffix">
<ng-container *nzStringTemplateOutlet="nzSuffix">{{ nzSuffix }}</ng-container>
</span>
</div>
`,
host: {
class: 'ant-statistic',
'[class.ant-statistic-rtl]': `dir === 'rtl'`
}
})
export class NzStatisticComponent implements OnDestroy, OnInit {
@Input() nzPrefix?: string | TemplateRef<void>;
Expand Down
4 changes: 2 additions & 2 deletions components/statistic/statistic.spec.ts
Expand Up @@ -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');
});
});
});
Expand Down

0 comments on commit 07df410

Please sign in to comment.