@@ -95,6 +95,12 @@ import ViewModeToggle from '~/components/ViewModeToggle.vue'
9595import PackageVulnerabilityTree from '~/components/PackageVulnerabilityTree.vue'
9696import PackageDeprecatedTree from '~/components/PackageDeprecatedTree.vue'
9797import DependencyPathPopup from '~/components/DependencyPathPopup.vue'
98+ import CompareFacetSelector from '~/components/compare/FacetSelector.vue'
99+ import ComparePackageSelector from '~/components/compare/PackageSelector.vue'
100+ import CompareMetricRow from '~/components/compare/MetricRow.vue'
101+ import CompareComparisonGrid from '~/components/compare/ComparisonGrid.vue'
102+ import CompareVersionPicker from '~/components/compare/VersionPicker.vue'
103+ import CompareComingSoonPlaceholder from '~/components/compare/ComingSoonPlaceholder.vue'
98104
99105describe ( 'component accessibility audits' , ( ) => {
100106 describe ( 'DateTime' , ( ) => {
@@ -1293,4 +1299,167 @@ describe('component accessibility audits', () => {
12931299 expect ( results . violations ) . toEqual ( [ ] )
12941300 } )
12951301 } )
1302+
1303+ // Compare feature components
1304+ describe ( 'CompareFacetSelector' , ( ) => {
1305+ it ( 'should have no accessibility violations' , async ( ) => {
1306+ const component = await mountSuspended ( CompareFacetSelector )
1307+ const results = await runAxe ( component )
1308+ expect ( results . violations ) . toEqual ( [ ] )
1309+ } )
1310+ } )
1311+
1312+ describe ( 'ComparePackageSelector' , ( ) => {
1313+ it ( 'should have no accessibility violations with no packages' , async ( ) => {
1314+ const component = await mountSuspended ( ComparePackageSelector , {
1315+ props : { modelValue : [ ] } ,
1316+ } )
1317+ const results = await runAxe ( component )
1318+ expect ( results . violations ) . toEqual ( [ ] )
1319+ } )
1320+
1321+ it ( 'should have no accessibility violations with packages selected' , async ( ) => {
1322+ const component = await mountSuspended ( ComparePackageSelector , {
1323+ props : { modelValue : [ 'vue' , 'react' ] } ,
1324+ } )
1325+ const results = await runAxe ( component )
1326+ expect ( results . violations ) . toEqual ( [ ] )
1327+ } )
1328+
1329+ it ( 'should have no accessibility violations at max packages' , async ( ) => {
1330+ const component = await mountSuspended ( ComparePackageSelector , {
1331+ props : { modelValue : [ 'vue' , 'react' , 'angular' , 'svelte' ] , max : 4 } ,
1332+ } )
1333+ const results = await runAxe ( component )
1334+ expect ( results . violations ) . toEqual ( [ ] )
1335+ } )
1336+ } )
1337+
1338+ describe ( 'CompareMetricRow' , ( ) => {
1339+ it ( 'should have no accessibility violations with basic values' , async ( ) => {
1340+ const component = await mountSuspended ( CompareMetricRow , {
1341+ props : {
1342+ label : 'Downloads' ,
1343+ description : 'Weekly download count' ,
1344+ values : [
1345+ { raw : 1000 , display : '1,000' } ,
1346+ { raw : 2000 , display : '2,000' } ,
1347+ ] ,
1348+ } ,
1349+ } )
1350+ const results = await runAxe ( component )
1351+ expect ( results . violations ) . toEqual ( [ ] )
1352+ } )
1353+
1354+ it ( 'should have no accessibility violations with diffs' , async ( ) => {
1355+ const component = await mountSuspended ( CompareMetricRow , {
1356+ props : {
1357+ label : 'Package Size' ,
1358+ description : 'Size of the package' ,
1359+ values : [
1360+ { raw : 100 , display : '100 KB' } ,
1361+ { raw : 150 , display : '150 KB' } ,
1362+ ] ,
1363+ diffs : [ null , { display : '+50%' , direction : 'increase' as const , favorable : false } ] ,
1364+ } ,
1365+ } )
1366+ const results = await runAxe ( component )
1367+ expect ( results . violations ) . toEqual ( [ ] )
1368+ } )
1369+
1370+ it ( 'should have no accessibility violations when loading' , async ( ) => {
1371+ const component = await mountSuspended ( CompareMetricRow , {
1372+ props : {
1373+ label : 'Install Size' ,
1374+ description : 'Total install size' ,
1375+ values : [ null , null ] ,
1376+ loading : true ,
1377+ } ,
1378+ } )
1379+ const results = await runAxe ( component )
1380+ expect ( results . violations ) . toEqual ( [ ] )
1381+ } )
1382+ } )
1383+
1384+ describe ( 'CompareComparisonGrid' , ( ) => {
1385+ it ( 'should have no accessibility violations with 2 columns' , async ( ) => {
1386+ const component = await mountSuspended ( CompareComparisonGrid , {
1387+ props : {
1388+ columns : 2 ,
1389+ headers : [ 'vue' , 'react' ] ,
1390+ } ,
1391+ slots : {
1392+ default : '<div>Grid content</div>' ,
1393+ } ,
1394+ } )
1395+ const results = await runAxe ( component )
1396+ expect ( results . violations ) . toEqual ( [ ] )
1397+ } )
1398+
1399+ it ( 'should have no accessibility violations with 3 columns' , async ( ) => {
1400+ const component = await mountSuspended ( CompareComparisonGrid , {
1401+ props : {
1402+ columns : 3 ,
1403+ headers : [ 'vue' , 'react' , 'angular' ] ,
1404+ } ,
1405+ slots : {
1406+ default : '<div>Grid content</div>' ,
1407+ } ,
1408+ } )
1409+ const results = await runAxe ( component )
1410+ expect ( results . violations ) . toEqual ( [ ] )
1411+ } )
1412+ } )
1413+
1414+ describe ( 'CompareVersionPicker' , ( ) => {
1415+ it ( 'should have no accessibility violations' , async ( ) => {
1416+ const component = await mountSuspended ( CompareVersionPicker , {
1417+ props : {
1418+ packageName : 'vue' ,
1419+ modelValue : '3.5.0' ,
1420+ label : 'From version' ,
1421+ } ,
1422+ } )
1423+ const results = await runAxe ( component )
1424+ expect ( results . violations ) . toEqual ( [ ] )
1425+ } )
1426+
1427+ it ( 'should have no accessibility violations with other version context' , async ( ) => {
1428+ const component = await mountSuspended ( CompareVersionPicker , {
1429+ props : {
1430+ packageName : 'vue' ,
1431+ modelValue : '3.5.0' ,
1432+ label : 'From version' ,
1433+ otherVersion : '3.4.0' ,
1434+ } ,
1435+ } )
1436+ const results = await runAxe ( component )
1437+ expect ( results . violations ) . toEqual ( [ ] )
1438+ } )
1439+ } )
1440+
1441+ describe ( 'CompareComingSoonPlaceholder' , ( ) => {
1442+ it ( 'should have no accessibility violations' , async ( ) => {
1443+ const component = await mountSuspended ( CompareComingSoonPlaceholder , {
1444+ props : {
1445+ title : 'File Diff' ,
1446+ description : 'Compare file changes between versions' ,
1447+ } ,
1448+ } )
1449+ const results = await runAxe ( component )
1450+ expect ( results . violations ) . toEqual ( [ ] )
1451+ } )
1452+
1453+ it ( 'should have no accessibility violations with icon' , async ( ) => {
1454+ const component = await mountSuspended ( CompareComingSoonPlaceholder , {
1455+ props : {
1456+ title : 'Dependency Diff' ,
1457+ description : 'Compare dependency changes' ,
1458+ icon : 'i-carbon:flow' ,
1459+ } ,
1460+ } )
1461+ const results = await runAxe ( component )
1462+ expect ( results . violations ) . toEqual ( [ ] )
1463+ } )
1464+ } )
12961465} )
0 commit comments