@@ -59,7 +59,8 @@ import ProvenanceBadge from '~/components/ProvenanceBadge.vue'
5959import MarkdownText from '~/components/MarkdownText.vue'
6060import PackageSkeleton from '~/components/PackageSkeleton.vue'
6161import PackageCard from '~/components/PackageCard.vue'
62- // import PackageDownloadAnalytics from '~/components/PackageDownloadAnalytics.vue'
62+ import ChartModal from '~/components/ChartModal.vue'
63+ import PackageDownloadAnalytics from '~/components/PackageDownloadAnalytics.vue'
6364import PackagePlaygrounds from '~/components/PackagePlaygrounds.vue'
6465import PackageDependencies from '~/components/PackageDependencies.vue'
6566import PackageVersions from '~/components/PackageVersions.vue'
@@ -322,6 +323,64 @@ describe('component accessibility audits', () => {
322323 } )
323324 } )
324325
326+ // Note: PackageWeeklyDownloadStats tests are skipped because vue-data-ui VueUiSparkline
327+ // component has issues in the test environment (requires DOM measurements that aren't
328+ // available during SSR-like test mounting).
329+
330+ describe ( 'ChartModal' , ( ) => {
331+ it ( 'should have no accessibility violations when closed' , async ( ) => {
332+ const component = await mountSuspended ( ChartModal , {
333+ props : { open : false } ,
334+ slots : { title : 'Downloads' , default : '<div>Chart content</div>' } ,
335+ } )
336+ const results = await runAxe ( component )
337+ expect ( results . violations ) . toEqual ( [ ] )
338+ } )
339+
340+ // Note: Testing the open state is challenging because native <dialog>.showModal()
341+ // requires the element to be in the DOM and connected, which doesn't work well
342+ // with the test environment's cloning approach. The dialog accessibility is
343+ // inherently provided by the native <dialog> element with aria-labelledby.
344+ } )
345+
346+ describe ( 'PackageDownloadAnalytics' , ( ) => {
347+ const mockWeeklyDownloads = [
348+ { downloads : 1000 , weekKey : '2024-W01' , weekStart : '2024-01-01' , weekEnd : '2024-01-07' } ,
349+ { downloads : 1200 , weekKey : '2024-W02' , weekStart : '2024-01-08' , weekEnd : '2024-01-14' } ,
350+ { downloads : 1500 , weekKey : '2024-W03' , weekStart : '2024-01-15' , weekEnd : '2024-01-21' } ,
351+ ]
352+
353+ it ( 'should have no accessibility violations (non-modal)' , async ( ) => {
354+ // Test only non-modal mode to avoid vue-data-ui chart rendering issues
355+ const component = await mountSuspended ( PackageDownloadAnalytics , {
356+ props : {
357+ weeklyDownloads : mockWeeklyDownloads ,
358+ packageName : 'vue' ,
359+ createdIso : '2020-01-01T00:00:00.000Z' ,
360+ inModal : false ,
361+ } ,
362+ } )
363+ const results = await runAxe ( component )
364+ expect ( results . violations ) . toEqual ( [ ] )
365+ } )
366+
367+ it ( 'should have no accessibility violations with empty data' , async ( ) => {
368+ const component = await mountSuspended ( PackageDownloadAnalytics , {
369+ props : {
370+ weeklyDownloads : [ ] ,
371+ packageName : 'vue' ,
372+ createdIso : null ,
373+ inModal : false ,
374+ } ,
375+ } )
376+ const results = await runAxe ( component )
377+ expect ( results . violations ) . toEqual ( [ ] )
378+ } )
379+
380+ // Note: Modal mode tests with inModal: true are skipped because vue-data-ui VueUiXy
381+ // component has issues in the test environment (requires DOM measurements).
382+ } )
383+
325384 describe ( 'PackagePlaygrounds' , ( ) => {
326385 it ( 'should have no accessibility violations with single link' , async ( ) => {
327386 const links = [
0 commit comments