@@ -536,6 +536,87 @@ describe('DtFilterPill Tests', function () {
536536 } ) ;
537537 } ) ;
538538
539+ describe ( 'Accessibility Tests' , ( ) => {
540+ describe . each ( [
541+ { mode : 'popover' , props : { } } ,
542+ { mode : 'dropdown' , props : { useDropdown : true , modelValue : MOCK_TEST_FILTERS } } ,
543+ ] ) ( 'ARIA attributes on the primary button ($mode mode)' , ( { props } ) => {
544+ beforeEach ( ( ) => {
545+ mockProps = props ;
546+ updateWrapper ( ) ;
547+ } ) ;
548+
549+ it ( 'Should have aria-haspopup' , ( ) => {
550+ expect ( button . attributes ( 'aria-haspopup' ) ) . toBeTruthy ( ) ;
551+ } ) ;
552+
553+ it ( 'Should have aria-expanded="false" by default' , ( ) => {
554+ expect ( button . attributes ( 'aria-expanded' ) ) . toBe ( 'false' ) ;
555+ } ) ;
556+
557+ it ( 'Should have aria-expanded="true" when open' , async ( ) => {
558+ await button . trigger ( 'click' ) ;
559+
560+ expect ( button . attributes ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
561+ } ) ;
562+
563+ it ( 'Should have aria-controls pointing to an id' , ( ) => {
564+ expect ( button . attributes ( 'aria-controls' ) ) . toBeTruthy ( ) ;
565+ } ) ;
566+ } ) ;
567+
568+ describe ( 'Keyboard navigation' , ( ) => {
569+ it . each ( [ 'ArrowDown' , 'ArrowUp' ] ) ( 'Should open popover on %s' , async ( key ) => {
570+ await button . trigger ( 'keydown' , { key } ) ;
571+
572+ expect ( wrapper . emitted ( 'open' ) [ 0 ] [ 0 ] ) . toBe ( true ) ;
573+ } ) ;
574+ } ) ;
575+
576+ describe ( 'Checkbox group labelling' , ( ) => {
577+ it ( 'Should have aria-label matching the label prop' , async ( ) => {
578+ mockProps = { label : MOCK_LABEL , modelValue : MOCK_TEST_FILTERS } ;
579+ updateWrapper ( ) ;
580+ await button . trigger ( 'click' ) ;
581+
582+ const checkboxGroup = document . querySelector ( '[data-qa="checkbox-group"]' ) ;
583+
584+ expect ( checkboxGroup . getAttribute ( 'aria-label' ) ) . toBe ( MOCK_LABEL ) ;
585+ } ) ;
586+ } ) ;
587+
588+ describe ( 'Clear button accessible name' , ( ) => {
589+ it ( 'Should fall back to localized "Clear filter" when endTooltipText is empty' , ( ) => {
590+ mockProps = { modelValue : [ { name : 'Test item 1' , active : true } ] } ;
591+ updateWrapper ( ) ;
592+
593+ expect ( clearButton . attributes ( 'aria-label' ) ) . toBe ( 'Clear filter' ) ;
594+ } ) ;
595+ } ) ;
596+
597+ describe ( 'Checkbox group name' , ( ) => {
598+ it ( 'Should use label prop as checkbox group name' , async ( ) => {
599+ mockProps = { label : 'Teams' , modelValue : MOCK_TEST_FILTERS } ;
600+ updateWrapper ( ) ;
601+ await button . trigger ( 'click' ) ;
602+
603+ const checkbox = document . querySelector ( 'input[type="checkbox"]' ) ;
604+
605+ expect ( checkbox . getAttribute ( 'name' ) ) . toBe ( 'Teams' ) ;
606+ } ) ;
607+
608+ it ( 'Should fall back to "filter-pill" when no label is provided' , async ( ) => {
609+ mockProps = { modelValue : MOCK_TEST_FILTERS } ;
610+ updateWrapper ( ) ;
611+ await button . trigger ( 'click' ) ;
612+
613+ const checkbox = document . querySelector ( 'input[type="checkbox"]' ) ;
614+
615+ expect ( checkbox . getAttribute ( 'name' ) ) . toBe ( 'filter-pill' ) ;
616+ } ) ;
617+ } ) ;
618+ } ) ;
619+
539620 describe ( 'Overlay Class Props Tests' , ( ) => {
540621 describe ( 'When popover class props are set' , ( ) => {
541622 it . each ( [
0 commit comments