Skip to content

Commit

Permalink
fix(badge): fix badge number is rtl (ant-design#43998)
Browse files Browse the repository at this point in the history
* fix(badge): fix badge number is rtl

* test: fix snapshots

* feat: use dir attribute instead of bdi

* test: update snapshots

* test: back of snapshot

---------

Co-authored-by: 二货机器人 <smith3816@gmail.com>
  • Loading branch information
NotEvenANeko and zombieJ authored Aug 14, 2023
1 parent d1bd2d0 commit e0e373f
Show file tree
Hide file tree
Showing 12 changed files with 1,353 additions and 1,163 deletions.
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx extend context correctly 1`] =
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -531,16 +533,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition: none;"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition: none;"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
32 changes: 18 additions & 14 deletions components/avatar/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ exports[`renders components/avatar/demo/badge.tsx correctly 1`] = `
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down Expand Up @@ -438,16 +440,18 @@ Array [
data-show="true"
title="1"
>
<span
class="ant-scroll-number-only"
style="transition:none"
>
<bdi>
<span
class="ant-scroll-number-only-unit current"
class="ant-scroll-number-only"
style="transition:none"
>
1
<span
class="ant-scroll-number-only-unit current"
>
1
</span>
</span>
</span>
</bdi>
</sup>
</span>
</div>
Expand Down
22 changes: 13 additions & 9 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ const ScrollNumber = React.forwardRef<HTMLElement, ScrollNumberProps>((props, re
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split('');

numberNodes = numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
));
numberNodes = (
<bdi>
{numberList.map((num, i) => (
<SingleNumber
prefixCls={prefixCls}
count={Number(count)}
value={num}
// eslint-disable-next-line react/no-array-index-key
key={numberList.length - i}
/>
))}
</bdi>
);
}

// allow specify the border
Expand Down
Loading

0 comments on commit e0e373f

Please sign in to comment.