@@ -2214,6 +2214,38 @@ describe('DataTable::dense', () => {
22142214 } ) ;
22152215} ) ;
22162216
2217+ describe ( 'DataTable::ariaLabel' , ( ) => {
2218+ test ( 'should render correctly when ariaLabel' , ( ) => {
2219+ const mock = dataMock ( ) ;
2220+ const { container } = render ( < DataTable data = { mock . data } columns = { mock . columns } ariaLabel = "Test Table" /> ) ;
2221+
2222+ expect ( container . firstChild ) . toMatchSnapshot ( ) ;
2223+ } ) ;
2224+
2225+ test ( 'should render correctly when not ariaLabel' , ( ) => {
2226+ const mock = dataMock ( ) ;
2227+ const { container } = render ( < DataTable data = { mock . data } columns = { mock . columns } /> ) ;
2228+
2229+ expect ( container . firstChild ) . toMatchSnapshot ( ) ;
2230+ } ) ;
2231+
2232+ test ( 'should render with aria-label when ariaLabel' , ( ) => {
2233+ const mock = dataMock ( ) ;
2234+ const { getByRole } = render ( < DataTable data = { mock . data } columns = { mock . columns } ariaLabel = "Test Table" /> ) ;
2235+
2236+ const table = getByRole ( 'table' ) ;
2237+ expect ( table . getAttribute ( 'aria-label' ) ) . toBe ( 'Test Table' ) ;
2238+ } ) ;
2239+
2240+ test ( 'should not render with aria-label when not ariaLabel' , ( ) => {
2241+ const mock = dataMock ( ) ;
2242+ const { getByRole } = render ( < DataTable data = { mock . data } columns = { mock . columns } /> ) ;
2243+
2244+ const table = getByRole ( 'table' ) ;
2245+ expect ( table . getAttribute ( 'aria-label' ) ) . toBeNull ( ) ;
2246+ } ) ;
2247+ } ) ;
2248+
22172249describe ( 'DataTable::Theming' , ( ) => {
22182250 test ( 'should render correctly when a custom style is applied' , ( ) => {
22192251 const mock = dataMock ( ) ;
0 commit comments