-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat(settings): Enable collapsing/expanding reset password warning
- Loading branch information
Showing
19 changed files
with
292 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/fxa-settings/src/components/ResetPasswordWarning/chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
packages/fxa-settings/src/components/ResetPasswordWarning/en.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## ResetPasswordWarning component | ||
## Warning shown to sync users that reset their password without using an account recovery key | ||
|
||
password-reset-warning-icon = Warning | ||
password-reset-chevron-expanded = Collapse warning | ||
password-reset-chevron-collapsed = Expand warning | ||
password-reset-data-may-not-be-recovered = Your browser data may not be recovered | ||
password-reset-previously-signed-in-device = Have a device where you previously signed in? | ||
password-reset-data-may-be-saved-locally = Your browser data may be locally saved on that device. Sign in there with your new password to restore and sync. | ||
password-reset-no-old-device = Have a new device but don’t have your old one? | ||
password-reset-encrypted-data-cannot-be-recovered = We’re sorry, but your encrypted browser data on Firefox servers can’t be recovered. However, you can still access your local data on any device where you have previously signed in. | ||
password-reset-learn-about-restoring-account-data = Learn more about restoring account data |
2 changes: 1 addition & 1 deletion
2
...eteResetPassword/icon-non-sync-device.svg → ...tPasswordWarning/icon-non-sync-device.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
...ompleteResetPassword/icon-sync-device.svg → ...ResetPasswordWarning/icon-sync-device.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
packages/fxa-settings/src/components/ResetPasswordWarning/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider'; | ||
import { screen, waitFor } from '@testing-library/react'; | ||
import ResetPasswordWarning from '.'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
describe('ResetPasswordWarning component', () => { | ||
it('renders as expected', async () => { | ||
renderWithLocalizationProvider(<ResetPasswordWarning />); | ||
|
||
expect( | ||
screen.getByRole('img', { | ||
name: 'Warning', | ||
}) | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText('Your browser data may not be recovered') | ||
).toBeVisible(); | ||
|
||
expect(screen.getByRole('img', { name: 'Collapse warning' })).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText('Have a device where you previously signed in?') | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText( | ||
'Your browser data may be locally saved on that device. Sign in there with your new password to restore and sync.' | ||
) | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText('Have a new device but don’t have your old one?') | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText( | ||
'We’re sorry, but your encrypted browser data on Firefox servers can’t be recovered. However, you can still access your local data on any device where you have previously signed in.' | ||
) | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByRole('link', { | ||
name: 'Learn more about restoring account data', | ||
}) | ||
).toBeVisible(); | ||
|
||
expect(screen.getByRole('link')).toHaveAttribute( | ||
'href', | ||
'https://support.mozilla.org/kb/how-reset-your-password-without-account-recovery-keys-access-data' | ||
); | ||
}); | ||
|
||
it('renders as expected with mobile width', async () => { | ||
global.innerWidth = 375; // Set mobile width | ||
global.dispatchEvent(new Event('resize')); | ||
|
||
renderWithLocalizationProvider(<ResetPasswordWarning />); | ||
|
||
expect( | ||
screen.getByRole('img', { | ||
name: 'Warning', | ||
}) | ||
).toBeVisible(); | ||
|
||
expect( | ||
screen.getByText('Your browser data may not be recovered') | ||
).toBeVisible(); | ||
|
||
expect(screen.getByRole('img', { name: 'Expand warning' })).toBeVisible(); | ||
|
||
expect( | ||
screen.queryByText('Have a device where you previously signed in?') | ||
).not.toBeVisible(); | ||
}); | ||
|
||
it('handles click/toggle as expected', async () => { | ||
const user = userEvent.setup(); | ||
global.innerWidth = 375; // Set mobile width | ||
global.dispatchEvent(new Event('resize')); | ||
|
||
renderWithLocalizationProvider(<ResetPasswordWarning />); | ||
|
||
user.click(screen.getByRole('img', { name: 'Expand warning' })); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByRole('group')).toHaveAttribute('open'); | ||
expect( | ||
screen.getByRole('img', { name: 'Collapse warning' }) | ||
).toBeVisible(); | ||
expect( | ||
screen.queryByRole('img', { name: 'Expand warning' }) | ||
).not.toBeInTheDocument(); | ||
}); | ||
|
||
user.click(screen.getByRole('img', { name: 'Collapse warning' })); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByRole('group')).not.toHaveAttribute('open'); | ||
expect(screen.getByRole('img', { name: 'Expand warning' })).toBeVisible(); | ||
expect( | ||
screen.queryByRole('img', { name: 'Collapse warning' }) | ||
).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.