@@ -6,7 +6,9 @@ import { afterEach, describe, expect, it } from 'vitest'
66import { mountSuspended } from '@nuxt/test-utils/runtime'
77
88// axe-core is a UMD module that exposes itself as window.axe in the browser
9- declare const axe : { run : ( context : Element , options ?: RunOptions ) => Promise < AxeResults > }
9+ declare const axe : {
10+ run : ( context : Element , options ?: RunOptions ) => Promise < AxeResults >
11+ }
1012
1113// Track mounted containers for cleanup
1214const mountedContainers : HTMLElement [ ] = [ ]
@@ -355,9 +357,24 @@ describe('component accessibility audits', () => {
355357
356358 describe ( 'PackageDownloadAnalytics' , ( ) => {
357359 const mockWeeklyDownloads = [
358- { downloads : 1000 , weekKey : '2024-W01' , weekStart : '2024-01-01' , weekEnd : '2024-01-07' } ,
359- { downloads : 1200 , weekKey : '2024-W02' , weekStart : '2024-01-08' , weekEnd : '2024-01-14' } ,
360- { downloads : 1500 , weekKey : '2024-W03' , weekStart : '2024-01-15' , weekEnd : '2024-01-21' } ,
360+ {
361+ downloads : 1000 ,
362+ weekKey : '2024-W01' ,
363+ weekStart : '2024-01-01' ,
364+ weekEnd : '2024-01-07' ,
365+ } ,
366+ {
367+ downloads : 1200 ,
368+ weekKey : '2024-W02' ,
369+ weekStart : '2024-01-08' ,
370+ weekEnd : '2024-01-14' ,
371+ } ,
372+ {
373+ downloads : 1500 ,
374+ weekKey : '2024-W03' ,
375+ weekStart : '2024-01-15' ,
376+ weekEnd : '2024-01-21' ,
377+ } ,
361378 ]
362379
363380 it ( 'should have no accessibility violations (non-modal)' , async ( ) => {
@@ -593,7 +610,12 @@ describe('component accessibility audits', () => {
593610 const mockTree = [
594611 { name : 'src' , type : 'directory' as const , path : 'src' , children : [ ] } ,
595612 { name : 'index.js' , type : 'file' as const , path : 'index.js' , size : 1024 } ,
596- { name : 'package.json' , type : 'file' as const , path : 'package.json' , size : 512 } ,
613+ {
614+ name : 'package.json' ,
615+ type : 'file' as const ,
616+ path : 'package.json' ,
617+ size : 512 ,
618+ } ,
597619 ]
598620
599621 it ( 'should have no accessibility violations' , async ( ) => {
@@ -760,7 +782,10 @@ describe('component accessibility audits', () => {
760782 links : { } ,
761783 publisher : { username : 'yyx990803' } ,
762784 } ,
763- score : { final : 0.9 , detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } } ,
785+ score : {
786+ final : 0.9 ,
787+ detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } ,
788+ } ,
764789 searchScore : 100000 ,
765790 } ,
766791 {
@@ -773,7 +798,10 @@ describe('component accessibility audits', () => {
773798 links : { } ,
774799 publisher : { username : 'fb' } ,
775800 } ,
776- score : { final : 0.9 , detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } } ,
801+ score : {
802+ final : 0.9 ,
803+ detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } ,
804+ } ,
777805 searchScore : 90000 ,
778806 } ,
779807 ]
@@ -1013,6 +1041,25 @@ describe('component accessibility audits', () => {
10131041 const results = await runAxe ( component )
10141042 expect ( results . violations ) . toEqual ( [ ] )
10151043 } )
1044+
1045+ it ( 'should total package count in paginated mode' , async ( ) => {
1046+ const component = await mountSuspended ( PackageListToolbar , {
1047+ props : {
1048+ filters : defaultFilters ,
1049+ sortOption : 'downloads-week-desc' ,
1050+ viewMode : 'table' ,
1051+ columns : mockColumns ,
1052+ paginationMode : 'paginated' ,
1053+ pageSize : 25 ,
1054+ totalCount : 9544 ,
1055+ filteredCount : 9544 ,
1056+ activeFilters : [ ] ,
1057+ } ,
1058+ } )
1059+
1060+ const html = component . html ( )
1061+ expect ( html ) . toContain ( '25 of 9,544' )
1062+ } )
10161063 } )
10171064
10181065 describe ( 'PackageTable' , ( ) => {
@@ -1027,15 +1074,23 @@ describe('component accessibility audits', () => {
10271074 links : { } ,
10281075 publisher : { username : 'yyx990803' } ,
10291076 } ,
1030- score : { final : 0.9 , detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } } ,
1077+ score : {
1078+ final : 0.9 ,
1079+ detail : { quality : 0.9 , popularity : 0.9 , maintenance : 0.9 } ,
1080+ } ,
10311081 searchScore : 100000 ,
10321082 } ,
10331083 ]
10341084
10351085 const mockColumns : ColumnConfig [ ] = [
10361086 { id : 'name' , label : 'Name' , visible : true , sortable : true } ,
10371087 { id : 'version' , label : 'Version' , visible : true , sortable : false } ,
1038- { id : 'description' , label : 'Description' , visible : true , sortable : false } ,
1088+ {
1089+ id : 'description' ,
1090+ label : 'Description' ,
1091+ visible : true ,
1092+ sortable : false ,
1093+ } ,
10391094 { id : 'downloads' , label : 'Downloads' , visible : true , sortable : true } ,
10401095 ]
10411096
@@ -1088,14 +1143,22 @@ describe('component accessibility audits', () => {
10881143 } ,
10891144 downloads : { weekly : 50000000 } ,
10901145 updated : '2024-01-01T00:00:00.000Z' ,
1091- score : { final : 0.95 , detail : { quality : 0.95 , popularity : 0.99 , maintenance : 0.9 } } ,
1146+ score : {
1147+ final : 0.95 ,
1148+ detail : { quality : 0.95 , popularity : 0.99 , maintenance : 0.9 } ,
1149+ } ,
10921150 searchScore : 99999 ,
10931151 }
10941152
10951153 const mockColumns : ColumnConfig [ ] = [
10961154 { id : 'name' , label : 'Name' , visible : true , sortable : true } ,
10971155 { id : 'version' , label : 'Version' , visible : true , sortable : false } ,
1098- { id : 'description' , label : 'Description' , visible : true , sortable : false } ,
1156+ {
1157+ id : 'description' ,
1158+ label : 'Description' ,
1159+ visible : true ,
1160+ sortable : false ,
1161+ } ,
10991162 ]
11001163
11011164 it ( 'should have no accessibility violations' , async ( ) => {
0 commit comments