File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ const likeAction = async () => {
7676 <div class =" flex items-center gap-4 justify-between shrink-0" >
7777 <ClientOnly >
7878 <TooltipApp
79+ v-if =" likesStatus !== 'pending'"
7980 :text =" likesData?.userHasLiked ? $t('package.likes.unlike') : $t('package.likes.like')"
8081 position =" bottom"
8182 >
@@ -92,20 +93,14 @@ const likeAction = async () => {
9293 >
9394 <span
9495 :class ="
95- likesStatus === 'pending'
96- ? 'i-lucide-heart'
97- : likesData?.userHasLiked
98- ? 'i-lucide-heart-minus text-red-500'
99- : 'i-lucide-heart-plus'
96+ likesData?.userHasLiked
97+ ? 'i-lucide-heart-minus text-red-500'
98+ : 'i-lucide-heart-plus'
10099 "
101100 class =" w-4 h-4"
102101 aria-hidden =" true"
103102 />
104- <span
105- v-if =" likesStatus === 'pending'"
106- class =" inline-block w-4 h-4 bg-bg-subtle rounded animate-pulse"
107- />
108- <span v-else >{{ compactNumberFormatter.format(likesData?.totalLikes ?? 0) }}</span >
103+ <span >{{ compactNumberFormatter.format(likesData?.totalLikes ?? 0) }}</span >
109104 </button >
110105 </TooltipApp >
111106 </ClientOnly >
Original file line number Diff line number Diff line change @@ -45,22 +45,10 @@ describe('PackageLikeCard', () => {
4545 expect ( wrapper . find ( 'span.truncate' ) . text ( ) ) . toBe ( '@scope/pkg' )
4646 } )
4747
48- it ( 'shows a loading skeleton instead of zero while like data is pending' , async ( ) => {
48+ it ( 'hides the like button entirely while like data is pending' , async ( ) => {
4949 wrapper = await mountLikeCard ( 'https://npmx.dev/package/vue' )
5050
5151 const button = wrapper . find ( 'button' )
52- expect ( button . text ( ) ) . not . toContain ( '0' )
53-
54- const skeleton = button . find ( '.animate-pulse' )
55- expect ( skeleton . exists ( ) ) . toBe ( true )
56- } )
57-
58- it ( 'shows a neutral heart icon while like data is pending' , async ( ) => {
59- wrapper = await mountLikeCard ( 'https://npmx.dev/package/vue' )
60-
61- const icon = wrapper . find ( 'button span[aria-hidden]' )
62- expect ( icon . classes ( ) ) . toContain ( 'i-lucide-heart' )
63- expect ( icon . classes ( ) ) . not . toContain ( 'i-lucide-heart-plus' )
64- expect ( icon . classes ( ) ) . not . toContain ( 'i-lucide-heart-minus' )
52+ expect ( button . exists ( ) ) . toBe ( false )
6553 } )
6654} )
You can’t perform that action at this time.
0 commit comments