Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-34263) feat(CreditV3): text logged out profile header #7610

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 />))
Loading