File tree Expand file tree Collapse file tree
packages/fxa-settings/src
components/Settings/SubRow
pages/Signin/SigninRecoveryChoice Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ tfa-row-backup-codes-title = Backup authentication codes
66tfa-row-backup-codes-not-available = No codes available
77# $numCodesRemaining - the number of backup authentication codes that have not yet been used (generally between 1 to 5)
88# A different message is shown when no codes are available
9- tfa-row-backup-codes-available = { $numCodesAvailable } codes remaining
9+ tfa-row-backup-codes-available-v2 = { $numCodesAvailable ->
10+ [ one ] { $numCodesAvailable } code remaining
11+ *[ other ] { $numCodesAvailable } codes remaining
12+ }
1013# Shown to users who have backup authentication codes - this will allow them to generate new codes to replace the previous ones
1114tfa-row-backup-codes-get-new-cta = Get new codes
1215# Shown to users who have no backup authentication codes
Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ describe('BackupCodesSubRow', () => {
6262 expect ( screen . getByText ( 'Get new codes' ) ) . toBeInTheDocument ( ) ;
6363 } ) ;
6464
65+ it ( 'renders correctly when 1 code is available' , ( ) => {
66+ renderWithLocalizationProvider (
67+ < BackupCodesSubRow { ...defaultProps } numCodesAvailable = { 1 } />
68+ ) ;
69+ expect (
70+ screen . getByText ( 'Backup authentication codes' )
71+ ) . toBeInTheDocument ( ) ;
72+ expect ( screen . getByText ( '1 code remaining' ) ) . toBeInTheDocument ( ) ;
73+ } ) ;
74+
6575 it ( 'renders description when showDescription is true' , ( ) => {
6676 renderWithLocalizationProvider ( < BackupCodesSubRow { ...defaultProps } /> ) ;
6777 expect (
Original file line number Diff line number Diff line change @@ -180,8 +180,10 @@ export const BackupCodesSubRow = ({
180180 < BackupCodesDisabledIcon className = "-ms-1 -my-2 scale-50" />
181181 ) ;
182182 const message = hasCodesRemaining ? (
183- < FtlMsg id = "tfa-row-backup-codes-available" vars = { { numCodesAvailable } } >
184- < p > { `${ numCodesAvailable } codes remaining` } </ p >
183+ < FtlMsg id = "tfa-row-backup-codes-available-v2" vars = { { numCodesAvailable } } >
184+ < p > { `${ numCodesAvailable } code${
185+ numCodesAvailable === 1 ? '' : 's'
186+ } remaining`} </ p >
185187 </ FtlMsg >
186188 ) : (
187189 < FtlMsg id = "tfa-row-backup-codes-not-available" >
Original file line number Diff line number Diff line change @@ -7,8 +7,12 @@ signin-recovery-method-subheader = Choose a recovery method
77signin-recovery-method-details = Let’s make sure it’s you using your recovery methods.
88signin-recovery-method-phone = Recovery phone
99signin-recovery-method-code-v2 = Backup authentication codes
10- # Variable: $numberOfCodes (String) - The number of authentication codes the user has left, e.g. 4
11- signin-recovery-method-code-info = { $numberOfCodes } codes remaining
10+ # Variable: $numBackupCodes (String) - The number of backup authentication codes the user has left, e.g., 4
11+ signin-recovery-method-code-info-v2 =
12+ { $numBackupCodes ->
13+ [ one ] { $numBackupCodes } code remaining
14+ *[ other ] { $numBackupCodes } codes remaining
15+ }
1216# Shown when a backend service fails and a code cannot be sent to the user's recovery phone.
1317signin-recovery-method-send-code-error-heading = There was a problem sending a code to your recovery phone
1418signin-recovery-method-send-code-error-description = Please try again later or use your backup authentication codes.
Original file line number Diff line number Diff line change @@ -74,6 +74,13 @@ describe('SigninRecoveryChoice', () => {
7474 expect (
7575 screen . getByLabelText ( / B a c k u p a u t h e n t i c a t i o n c o d e s / i)
7676 ) . toBeInTheDocument ( ) ;
77+ expect ( screen . getByText ( '4 codes remaining' ) ) . toBeInTheDocument ( ) ;
78+ } ) ;
79+
80+ it ( 'renders as expected with one backup authentication code' , ( ) => {
81+ renderSigninRecoveryChoice ( { numBackupCodes : 1 } ) ;
82+
83+ expect ( screen . getByText ( '1 code remaining' ) ) . toBeInTheDocument ( ) ;
7784 } ) ;
7885
7986 it ( 'calls handlePhoneChoice when Recovery phone option is selected' , async ( ) => {
Original file line number Diff line number Diff line change @@ -112,9 +112,9 @@ const SigninRecoveryChoice = ({
112112 'Backup authentication codes'
113113 ) ,
114114 localizedChoiceInfo : ftlMsgResolver . getMsg (
115- 'signin-recovery-method-code-info' ,
116- `${ numBackupCodes } codes remaining` ,
117- { numberOfCodes : numBackupCodes }
115+ 'signin-recovery-method-code-info-v2 ' ,
116+ `${ numBackupCodes } code ${ numBackupCodes === 1 ? '' : 's' } remaining` ,
117+ { numBackupCodes }
118118 ) ,
119119 } ,
120120 ] ;
You can’t perform that action at this time.
0 commit comments