Skip to content

Commit d17cbf9

Browse files
committed
test(ui): use direct references to the component
Solve the function component cannot set `displayName`.
1 parent a61fa5f commit d17cbf9

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

packages/ui/src/components/_footer/Footer.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { DFooter } from './Footer';
88

99
describe('DFooter', () => {
1010
const okButton = (footer: ShallowWrapper) => {
11-
return footer.find('DButton').at(1);
11+
return footer.find(DButton).at(1);
1212
};
1313
const cancelButton = (footer: ShallowWrapper) => {
14-
return footer.find('DButton').at(0);
14+
return footer.find(DButton).at(0);
1515
};
1616

1717
it('should `dAlign` work', () => {
@@ -22,9 +22,9 @@ describe('DFooter', () => {
2222
it('should `dButtons` work', () => {
2323
const footer = shallow(<DFooter dButtons={['cancel', <DButton>Button</DButton>, 'ok']} />);
2424

25-
expect(footer.find('DButton').length).toBe(3);
25+
expect(footer.find(DButton).length).toBe(3);
2626

27-
footer.find('DButton').forEach((button, index) => {
27+
footer.find(DButton).forEach((button, index) => {
2828
switch (index) {
2929
case 0:
3030
expect(button.text()).toBe('Cancel');

packages/ui/src/components/button/Button.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,3 @@ export const DButton = React.forwardRef<HTMLButtonElement, DButtonProps>((props,
115115
</button>
116116
);
117117
});
118-
119-
DButton.displayName = 'DButton';

0 commit comments

Comments
 (0)