@@ -1647,7 +1647,7 @@ describe('Signin component', () => {
16471647 it ( 'sets the shared page title from CMS' , ( ) => {
16481648 // Ensure pageTitle is not available on SigninPage, cast to type
16491649 // to allow undefined
1650- ( cmsProps . cmsInfo as RelierCmsInfo ) . SigninPage . pageTitle = undefined ;
1650+ ( cmsProps . cmsInfo as RelierCmsInfo ) . SigninPage ! . pageTitle = undefined ;
16511651 render ( { integration : createMockSigninWebIntegration ( cmsProps ) } ) ;
16521652
16531653 expect ( document . title ) . toBe (
@@ -1695,23 +1695,37 @@ describe('Signin component', () => {
16951695 } ) ;
16961696
16971697 it ( 'renders CardHeader with CMS content when password is not needed' , ( ) => {
1698- // This path: isPasswordNeededRef.current && hasPassword === false
1699- // Renders CardHeader with different props but still uses CMS logo
1698+ const cmsProps = {
1699+ cmsInfo : {
1700+ ...MOCK_CMS_INFO ,
1701+ SigninCachedPage : undefined ,
1702+ SigninPage : {
1703+ headline : 'CMS override' ,
1704+ description : 'just for you!' ,
1705+ primaryButtonText : 'Click me' ,
1706+ pageTitle : 'I am a title' ,
1707+ } ,
1708+ } ,
1709+ } ;
1710+
1711+ // No SigninCachedPage and password not needed, so CMS headline
1712+ // is not available and the heading falls back to default
17001713 render ( {
17011714 integration : createMockSigninWebIntegration ( cmsProps ) ,
17021715 hasPassword : false ,
17031716 } ) ;
17041717
1705- const cmsLogo = screen . getByRole ( 'img' , {
1706- name : cmsProps . cmsInfo . shared . logoAltText ,
1707- } ) ;
1708- expect ( cmsLogo ) . toMatchSnapshot ( ) ;
1718+ // No CMS headline from SigninCachedPage, so no CMS logo rendered
1719+ expect (
1720+ screen . queryByRole ( 'img' , {
1721+ name : cmsProps . cmsInfo . shared . logoAltText ,
1722+ } )
1723+ ) . not . toBeInTheDocument ( ) ;
17091724
1710- // When no SigninCachedPage is set, the non-password path falls back
1711- // to SigninPage headline and description
1725+ // Falls back to the default "Sign in" text
17121726 expect (
17131727 screen . getByRole ( 'heading' , {
1714- name : cmsProps . cmsInfo . SigninPage . headline ,
1728+ name : 'Sign in' ,
17151729 } )
17161730 ) . toBeInTheDocument ( ) ;
17171731 } ) ;
@@ -1784,17 +1798,22 @@ describe('Signin component', () => {
17841798 ) . toBeInTheDocument ( ) ;
17851799 } ) ;
17861800
1787- it ( 'falls back to SigninPage CMS config when SigninCachedPage is not set' , ( ) => {
1801+ it ( 'falls back to headingText when SigninCachedPage is not set' , ( ) => {
17881802 render ( {
17891803 integration : createMockSigninWebIntegration ( cmsProps ) ,
17901804 sessionToken : MOCK_SESSION_TOKEN ,
17911805 hasPassword : true ,
17921806 } ) ;
17931807
1808+ // Cached users should not see SigninPage CMS headline
17941809 expect (
1795- screen . getByRole ( 'heading' , {
1810+ screen . queryByRole ( 'heading' , {
17961811 name : cmsProps . cmsInfo . SigninPage . headline ,
17971812 } )
1813+ ) . not . toBeInTheDocument ( ) ;
1814+ // Should fall back to default headingText
1815+ expect (
1816+ screen . getByRole ( 'heading' , { name : 'Sign in' } )
17981817 ) . toBeInTheDocument ( ) ;
17991818 } ) ;
18001819
0 commit comments