File tree Expand file tree Collapse file tree
test/nuxt/components/compare Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -283,23 +283,27 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
283283 </VueUiHorizontalBar >
284284
285285 <template #fallback >
286- <div class =" flex flex-col gap-2 justify-center items-center mb-2" >
287- <SkeletonInline class =" h-4 w-16" />
288- <SkeletonInline class =" h-4 w-28" />
289- </div >
290- <div class =" flex flex-col gap-1" >
291- <SkeletonInline class =" h-7 w-full" v-for =" pkg in packages" :key =" pkg" />
286+ <div class =" flex flex-col gap-3" data-test =" facet-bar-chart-skeleton" >
287+ <div class =" flex flex-col items-center gap-2 mb-3" >
288+ <SkeletonInline class =" h-5 w-36 max-w-full" />
289+ <SkeletonInline class =" h-4 w-52 max-w-full" />
290+ </div >
291+ <div class =" flex flex-col gap-2" >
292+ <SkeletonInline class =" h-8 w-full" v-for =" pkg in packages" :key =" pkg" />
293+ </div >
292294 </div >
293295 </template >
294296 </ClientOnly >
295297
296298 <template v-else >
297- <div class =" flex flex-col gap-2 justify-center items-center mb-2" >
298- <SkeletonInline class =" h-4 w-16" />
299- <SkeletonInline class =" h-4 w-28" />
300- </div >
301- <div class =" flex flex-col gap-1" >
302- <SkeletonInline class =" h-7 w-full" v-for =" pkg in packages" :key =" pkg" />
299+ <div class =" flex flex-col gap-3" data-test =" facet-bar-chart-skeleton" >
300+ <div class =" flex flex-col items-center gap-2 mb-3" >
301+ <SkeletonInline class =" h-5 w-36 max-w-full" />
302+ <SkeletonInline class =" h-4 w-52 max-w-full" />
303+ </div >
304+ <div class =" flex flex-col gap-2" >
305+ <SkeletonInline class =" h-8 w-full" v-for =" pkg in packages" :key =" pkg" />
306+ </div >
303307 </div >
304308 </template >
305309 </div >
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest'
2+ import { mountSuspended } from '@nuxt/test-utils/runtime'
3+ import FacetBarChart from '~/components/Compare/FacetBarChart.vue'
4+
5+ describe ( 'FacetBarChart' , ( ) => {
6+ it ( 'renders a taller loading skeleton with title and subtitle placeholders' , async ( ) => {
7+ const component = await mountSuspended ( FacetBarChart , {
8+ props : {
9+ values : [ null , null ] ,
10+ packages : [ 'react' , 'vue' ] ,
11+ label : 'Bundle size' ,
12+ description : 'Compare install footprint' ,
13+ facetLoading : true ,
14+ } ,
15+ } )
16+
17+ const skeleton = component . find ( '[data-test="facet-bar-chart-skeleton"]' )
18+ expect ( skeleton . exists ( ) ) . toBe ( true )
19+
20+ const lines = skeleton . findAllComponents ( { name : 'SkeletonInline' } )
21+ expect ( lines ) . toHaveLength ( 4 )
22+ expect ( lines [ 0 ] ?. attributes ( 'class' ) ) . toContain ( 'h-5' )
23+ expect ( lines [ 1 ] ?. attributes ( 'class' ) ) . toContain ( 'h-4' )
24+ expect ( lines [ 2 ] ?. attributes ( 'class' ) ) . toContain ( 'h-8' )
25+ expect ( lines [ 3 ] ?. attributes ( 'class' ) ) . toContain ( 'h-8' )
26+ } )
27+ } )
You can’t perform that action at this time.
0 commit comments