Skip to content

Commit

Permalink
test(ui): fix test for dIconRight of button
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed Mar 17, 2023
1 parent 9e4339e commit d2dc4f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ui/src/components/button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getTypeClass = (dType: DButtonProps['dType'], prefix = dPrefix) => {
const getThemeClass = (dTheme: DButtonProps['dTheme'], prefix = 't') => {
return `${prefix}-${dTheme || 'primary'}`;
};
const getOtherClass = (ots?: 'icon' | DSize | 'block' | DButtonProps['dVariant'] | 'icon-right', separator = '--', prefix = dPrefix) => {
const getOtherClass = (ots?: 'icon' | DSize | 'block' | DButtonProps['dVariant'], separator = '--', prefix = dPrefix) => {
return !ots ? `${prefix}button` : `${prefix}button${separator}${ots || ''}`;
};

Expand Down Expand Up @@ -191,7 +191,8 @@ describe('DButton', () => {
</DButton>
);
const button = getByRole('button');
expect(button.className.includes(getOtherClass('icon-right'))).toBe(true);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
expect(button.children.item(0)!.innerHTML.includes('Hello World')).toBe(true);
});
});

Expand Down

0 comments on commit d2dc4f1

Please sign in to comment.