@@ -443,8 +443,9 @@ describe('MinimalFooter', () => {
443443
444444 expect ( sections [ 0 ] ) . toContainElement ( container . querySelector ( '.Footer__terms' ) )
445445
446- const topRegion = container . querySelector ( '[data-footer-region="top"]' )
447- expect ( topRegion ) . toBeInTheDocument ( )
446+ const topSection = container . querySelector ( '.Footer__top' ) ?. parentElement
447+ expect ( topSection ) . toBeInTheDocument ( )
448+ expect ( topSection ) . toHaveClass ( 'Footer__section' )
448449 } )
449450
450451 it ( 'renders component with only footnotes' , ( ) => {
@@ -691,31 +692,30 @@ describe('MinimalFooter', () => {
691692 expect ( queryByRole ( 'link' , { name : 'Link 6' } ) ) . not . toBeInTheDocument ( )
692693 } )
693694
694- it ( 'omits the content region when no Content is provided' , ( ) => {
695+ it ( 'omits the content section when no Content is provided' , ( ) => {
695696 const { container} = render ( < MinimalFooter /> )
696697
697- const regions = Array . from ( container . querySelectorAll ( '[data-footer-region]' ) ) . map ( region =>
698- region . getAttribute ( 'data-footer-region' ) ,
699- )
700-
701- expect ( regions ) . toEqual ( [ 'top' , 'bottom' ] )
698+ const footer = container . querySelector ( 'footer' )
699+ expect ( footer ?. children [ 0 ] ) . toHaveClass ( 'Footer__section' )
700+ expect ( footer ?. children [ 0 ] ) . toContainElement ( container . querySelector ( '.Footer__top' ) )
701+ expect ( footer ?. children [ 1 ] ) . toHaveClass ( 'Footer__section--bottom' )
702702 } )
703703
704- it ( 'renders top, content, and bottom regions in the approved order' , ( ) => {
704+ it ( 'renders top, content, and bottom sections in the approved order' , ( ) => {
705705 const { container, getByText} = render (
706706 < MinimalFooter >
707707 < MinimalFooter . Content > Custom content</ MinimalFooter . Content >
708708 </ MinimalFooter > ,
709709 )
710710
711- const regions = Array . from ( container . querySelectorAll ( '[data- footer-region]' ) ) . map ( region =>
712- region . getAttribute ( 'data-footer-region' ) ,
713- )
714-
715- expect ( regions ) . toEqual ( [ 'top' , 'content' , ' bottom'] )
716- expect ( container . querySelector ( '[data-footer-region="top"] .Footer__logo' ) ) . toBeInTheDocument ( )
717- expect ( getByText ( 'Custom content' ) . closest ( '[data-footer-region=" bottom"] ' ) ) . not . toBeInTheDocument ( )
718- expect ( getByText ( 'Custom content' ) . closest ( '[data-footer-region=" content"] ' ) ) . toBeInTheDocument ( )
711+ const footer = container . querySelector ( ' footer' )
712+ expect ( footer ?. children [ 0 ] ) . toHaveClass ( 'Footer__section' )
713+ expect ( footer ?. children [ 0 ] ) . toContainElement ( container . querySelector ( '.Footer__top' ) )
714+ expect ( footer ?. children [ 1 ] ) . toHaveClass ( 'Footer__section--content' )
715+ expect ( footer ?. children [ 2 ] ) . toHaveClass ( 'Footer__section-- bottom')
716+ expect ( container . querySelector ( '.Footer__top .Footer__logo' ) ) . toBeInTheDocument ( )
717+ expect ( getByText ( 'Custom content' ) . closest ( '.Footer__section-- bottom' ) ) . not . toBeInTheDocument ( )
718+ expect ( getByText ( 'Custom content' ) . closest ( '.Footer__section-- content' ) ) . toBeInTheDocument ( )
719719 } )
720720
721721 it ( 'places the logomark and Back to Top in the same top row' , ( ) => {
@@ -731,18 +731,18 @@ describe('MinimalFooter', () => {
731731 expect ( logo . closest ( '.Footer__top-row' ) ) . toBe ( backToTop . closest ( '.Footer__top-row' ) )
732732 } )
733733
734- it ( 'places footer links and social links in the bottom region ' , ( ) => {
734+ it ( 'places footer links and social links in the bottom section ' , ( ) => {
735735 const { getByRole} = render (
736736 < MinimalFooter socialLinks = { [ 'x' ] } >
737737 < MinimalFooter . Link href = "/test" > Test Link</ MinimalFooter . Link >
738738 </ MinimalFooter > ,
739739 )
740740
741- expect ( getByRole ( 'link' , { name : 'Test Link' } ) . closest ( '[data-footer-region=" bottom"] ' ) ) . toBeInTheDocument ( )
742- expect ( getByRole ( 'link' , { name : 'GitHub on X' } ) . closest ( '[data-footer-region=" bottom"] ' ) ) . toBeInTheDocument ( )
741+ expect ( getByRole ( 'link' , { name : 'Test Link' } ) . closest ( '.Footer__section-- bottom' ) ) . toBeInTheDocument ( )
742+ expect ( getByRole ( 'link' , { name : 'GitHub on X' } ) . closest ( '.Footer__section-- bottom' ) ) . toBeInTheDocument ( )
743743 } )
744744
745- it ( 'places Footnotes ahead of the mapped regions and preserves full region order when every optional child is present' , ( ) => {
745+ it ( 'places Footnotes ahead of the mapped sections and preserves full section order when every optional child is present' , ( ) => {
746746 const { getByRole} = render (
747747 < MinimalFooter >
748748 < MinimalFooter . Footnotes >
@@ -755,11 +755,14 @@ describe('MinimalFooter', () => {
755755 )
756756
757757 const footer = getByRole ( 'contentinfo' )
758- const topLevelRegionNames = Array . from ( footer . children ) . map (
759- element => element . getAttribute ( 'data-footer-region' ) ?? 'footnotes' ,
760- )
758+ const topLevelSectionNames = Array . from ( footer . children ) . map ( element => {
759+ if ( element . classList . contains ( 'Footer__section--content' ) ) return 'content'
760+ if ( element . classList . contains ( 'Footer__section--bottom' ) ) return 'bottom'
761+ if ( element . querySelector ( '.Footer__top' ) ) return 'top'
762+ return 'footnotes'
763+ } )
761764
762- expect ( topLevelRegionNames ) . toEqual ( [ 'footnotes' , 'top' , 'content' , 'bottom' ] )
765+ expect ( topLevelSectionNames ) . toEqual ( [ 'footnotes' , 'top' , 'content' , 'bottom' ] )
763766 } )
764767
765768 it ( 'does not impose internal layout on MinimalFooter.Content' , ( ) => {
@@ -773,7 +776,7 @@ describe('MinimalFooter', () => {
773776 </ MinimalFooter > ,
774777 )
775778
776- // The region wrapper only positions Content within the footer; it does not alter or
779+ // The section wrapper only positions Content within the footer; it does not alter or
777780 // wrap the consumer's own children.
778781 expect ( getByTestId ( 'consumer-layout' ) . parentElement ) . toHaveClass ( 'Footer__container' )
779782 } )
@@ -789,23 +792,17 @@ describe('MinimalFooter', () => {
789792 expect ( queryAllByRole ( 'link' , { name : isSocialLink } ) ) . toHaveLength ( 0 )
790793 } )
791794
792- it ( 'marks the bottom region with stable social and no-social layout hooks ' , ( ) => {
795+ it ( 'applies a no-social modifier class to the bottom section ' , ( ) => {
793796 const { container, rerender} = render (
794797 < MinimalFooter >
795798 < MinimalFooter . Link href = "/test" > Test Link</ MinimalFooter . Link >
796799 </ MinimalFooter > ,
797800 )
798801
799- expect ( container . querySelector ( '[data-footer-region="bottom"] section' ) ) . toHaveAttribute (
800- 'data-footer-layout' ,
801- 'social' ,
802- )
802+ expect ( container . querySelector ( '.Footer__bottom' ) ) . not . toHaveClass ( 'Footer__bottom--no-social' )
803803
804804 rerender ( < MinimalFooter socialLinks = { false } /> )
805- expect ( container . querySelector ( '[data-footer-region="bottom"] section' ) ) . toHaveAttribute (
806- 'data-footer-layout' ,
807- 'no-social' ,
808- )
805+ expect ( container . querySelector ( '.Footer__bottom' ) ) . toHaveClass ( 'Footer__bottom--no-social' )
809806 } )
810807
811808 it ( 'preserves logo href, analytics, accessibility, and semantic styling' , ( ) => {
@@ -891,15 +888,15 @@ describe('MinimalFooter', () => {
891888 expect ( queryByRole ( 'button' , { name : 'Second' } ) ) . not . toBeInTheDocument ( )
892889 } )
893890
894- it ( 'renders Back to Top within the top region ' , ( ) => {
891+ it ( 'renders Back to Top within the top section ' , ( ) => {
895892 const { getByRole} = render (
896893 < MinimalFooter >
897894 < MinimalFooter . BackToTop > Back to top</ MinimalFooter . BackToTop >
898895 </ MinimalFooter > ,
899896 )
900897
901898 const button = getByRole ( 'button' , { name : 'Back to top' } )
902- expect ( button . closest ( '[data-footer-region="top"] ' ) ) . toBeInTheDocument ( )
899+ expect ( button . closest ( '.Footer__section ' ) ) . toBeInTheDocument ( )
903900 } )
904901
905902 it ( 'forwards ARIA, data, analytics, and native button attributes' , ( ) => {
0 commit comments