Skip to content

Commit

Permalink
(PC-34263) feat(CreditV3): text logged out profile header (#7610)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgerrard-pass authored Jan 30, 2025
1 parent 1eeae42 commit fcb70d4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const LoggedOutHeader: FunctionComponent<Props> = ({ showForceUpdateBanne
const { data: settings } = useSettingsContext()
const enableCreditV3 = settings?.wipEnableCreditV3
const subtitle = `Tu as ${enableCreditV3 ? '17 ou 18' : 'entre 15 et 18'} ans\u00a0?`
const bodyText = `Identifie-toi pour découvrir des offres culturelles et bénéficier de ton crédit si tu as ${enableCreditV3 ? '17 ou 18' : 'entre 15 et 18'} ans.`

const { isDesktopViewport, colors } = useTheme()

Expand All @@ -34,10 +35,7 @@ export const LoggedOutHeader: FunctionComponent<Props> = ({ showForceUpdateBanne
showForceUpdateBanner={showForceUpdateBanner}
title="Mon profil"
subtitle={isPassForAllEnabled ? undefined : subtitle}>
<TypoDS.Body>
Identifie-toi pour découvrir des offres culturelles et bénéficier de ton crédit si tu as
entre 15 et 18 ans.
</TypoDS.Body>
<TypoDS.Body>{bodyText}</TypoDS.Body>
<Spacer.Column numberOfSpaces={5} />
<Container>
<InternalTouchableLink
Expand Down
41 changes: 40 additions & 1 deletion src/features/profile/pages/Profile.web.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'

import { setSettings } from 'features/auth/tests/setSettings'
import { setFeatureFlags } from 'libs/firebase/firestore/featureFlags/__tests__/setFeatureFlags'
import { reactQueryProviderHOC } from 'tests/reactQueryProviderHOC'
import { checkAccessibilityFor, render, screen } from 'tests/utils/web'
Expand All @@ -17,7 +18,9 @@ jest.mock('ui/theme/customFocusOutline/customFocusOutline')
jest.spyOn(useVersion, 'useVersion').mockReturnValue('Version\u00A01.10.5')

describe('<Profile/>', () => {
beforeEach(() => setFeatureFlags())
beforeEach(() => {
setFeatureFlags()
})

describe('Accessibility', () => {
it('should not have basic accessibility issues', async () => {
Expand Down Expand Up @@ -59,6 +62,42 @@ describe('<Profile/>', () => {

expect(container).toMatchSnapshot()
})

describe('if enableCreditV3 is true', () => {
beforeEach(() => {
setSettings({ wipEnableCreditV3: true })
})

it('should see "17 ou 18"', async () => {
render(reactQueryProviderHOC(<Profile />), {
theme: { isDesktopViewport: true },
})

const text = await screen.findByText(
'Identifie-toi pour découvrir des offres culturelles et bénéficier de ton crédit si tu as 17 ou 18 ans.'
)

expect(text).toBeTruthy()
})
})

describe('if enableCreditV3 is false', () => {
beforeEach(() => {
setSettings()
})

it('should see "15 et 18"', async () => {
render(reactQueryProviderHOC(<Profile />), {
theme: { isDesktopViewport: true },
})

const text = await screen.findByText(
'Identifie-toi pour découvrir des offres culturelles et bénéficier de ton crédit si tu as entre 15 et 18 ans.'
)

expect(text).toBeTruthy()
})
})
})

const renderProfile = () => render(reactQueryProviderHOC(<Profile />))

0 comments on commit fcb70d4

Please sign in to comment.