-
+
{
prefixDataTestId="avatar"
{...{ avatar }}
/>
-
+
-
+
{
route="/settings/display_name"
prefixDataTestId="display-name"
/>
-
+
-
+
{
headerValueClassName="break-all"
prefixDataTestId="primary-email"
/>
-
+
diff --git a/packages/fxa-settings/src/components/Security/index.test.tsx b/packages/fxa-settings/src/components/Security/index.test.tsx
index 2921d4b74f..9896bddb15 100644
--- a/packages/fxa-settings/src/components/Security/index.test.tsx
+++ b/packages/fxa-settings/src/components/Security/index.test.tsx
@@ -7,8 +7,15 @@ import { screen } from '@testing-library/react';
import Security from '.';
import { mockAppContext, renderWithRouter } from '../../models/mocks';
import { Account, AppContext } from '../../models';
+import { getFtlBundle, testL10n } from 'fxa-react/lib/test-utils';
+import { FluentBundle } from '@fluent/bundle';
describe('Security', () => {
+ let bundle: FluentBundle;
+ beforeAll(async () => {
+ bundle = await getFtlBundle('settings');
+ });
+
it('renders "fresh load"
with correct content', async () => {
const account = {
avatar: { url: null, id: null },
@@ -68,7 +75,7 @@ describe('Security', () => {
passwordCreated: 1234567890,
hasPassword: true,
} as unknown as Account;
- const createDate = new Date(1234567890).getDate();
+ const createDate = `1/${new Date(1234567890).getDate()}/1970`;
renderWithRouter(
@@ -76,8 +83,13 @@ describe('Security', () => {
);
const passwordRouteLink = screen.getByTestId('password-unit-row-route');
+ const ftlMsgMock = screen.getByTestId('ftlmsg-mock');
+ testL10n(ftlMsgMock, bundle, {
+ date: createDate,
+ });
+
await screen.findByText('••••••••••••••••••');
- await screen.findByText(`Created 1/${createDate}/1970`);
+ await screen.findByText(`Created ${createDate}`);
expect(passwordRouteLink).toHaveTextContent('Change');
expect(passwordRouteLink).toHaveAttribute(
diff --git a/packages/fxa-settings/src/components/Security/index.tsx b/packages/fxa-settings/src/components/Security/index.tsx
index 8e3048c4bf..76da136423 100644
--- a/packages/fxa-settings/src/components/Security/index.tsx
+++ b/packages/fxa-settings/src/components/Security/index.tsx
@@ -8,6 +8,7 @@ import UnitRowRecoveryKey from '../UnitRowRecoveryKey';
import UnitRowTwoStepAuth from '../UnitRowTwoStepAuth';
import { UnitRow } from '../UnitRow';
import { useAccount } from '../../models';
+import { FtlMsg } from 'fxa-react/lib/utils';
const PwdDate = ({ passwordCreated }: { passwordCreated: number }) => {
const pwdDateText = Intl.DateTimeFormat('default', {
@@ -17,11 +18,11 @@ const PwdDate = ({ passwordCreated }: { passwordCreated: number }) => {
}).format(new Date(passwordCreated));
return (
-
+
Created {pwdDateText}
-
+
);
};
@@ -62,8 +63,8 @@ export const Security = () => {
) : (
- Set a password to sync and use certain account
- security features.
+ Set a password to sync and use certain account security
+ features.
)}
diff --git a/packages/fxa-settings/src/setupTests.js b/packages/fxa-settings/src/setupTests.tsx
similarity index 53%
rename from packages/fxa-settings/src/setupTests.js
rename to packages/fxa-settings/src/setupTests.tsx
index 8c81f88ecb..d2e50f24f2 100644
--- a/packages/fxa-settings/src/setupTests.js
+++ b/packages/fxa-settings/src/setupTests.tsx
@@ -3,3 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import '@testing-library/jest-dom/extend-expect';
+import { FtlMsgProps } from 'fxa-react/lib/utils';
+
+jest.mock('fxa-react/lib/utils', () => ({
+ FtlMsg: (props: FtlMsgProps) => (
+
+ {props.children}
+
+ ),
+}));
diff --git a/yarn.lock b/yarn.lock
index 8ee1249dd6..4f91e5cb8b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -21461,13 +21461,6 @@ __metadata:
languageName: node
linkType: hard
-"es6-promisify@npm:^6.1.1":
- version: 6.1.1
- resolution: "es6-promisify@npm:6.1.1"
- checksum: e57dfa8b6533387e6cae115bdc1591e4e6e7648443741360c4f4f8f1d2c17d1f0fb293ccd3f86193f016c236ed15f336e075784eab7ec9a67af0aed2b949dd7c
- languageName: node
- linkType: hard
-
"es6-shim@npm:^0.35.5":
version: 0.35.5
resolution: "es6-shim@npm:0.35.5"
@@ -25361,6 +25354,10 @@ fsevents@~2.1.1:
fxa-shared: "workspace:*"
get-orientation: ^1.1.2
graphql: ^15.6.1
+ grunt: ^1.5.3
+ grunt-cli: ^1.4.3
+ grunt-contrib-concat: ^2.1.0
+ grunt-contrib-watch: ^1.1.0
jest-watch-typeahead: 0.6.5
lodash.groupby: ^4.6.0
mutationobserver-shim: ^0.3.7
@@ -25383,8 +25380,6 @@ fsevents@~2.1.1:
typescript: ^4.8.2
uuid: ^9.0.0
webpack: ^4.43.0
- webpack-merge-and-include-globally: ^2.3.4
- webpack-watch-files-plugin: ^1.2.1
languageName: unknown
linkType: soft
@@ -41353,13 +41348,6 @@ resolve@^2.0.0-next.3:
languageName: node
linkType: hard
-"rev-hash@npm:^3.0.0":
- version: 3.0.0
- resolution: "rev-hash@npm:3.0.0"
- checksum: d7af9e411b945cae85c40d3d5e061589b5e84b16d3ffddcee948766ca4e70e7040942fc9aee0e8a4d64e1edf832730687bbcaf63577b8b6ca59866116bd8f6bd
- languageName: node
- linkType: hard
-
"rework-visit@npm:1.0.0":
version: 1.0.0
resolution: "rework-visit@npm:1.0.0"
@@ -47182,19 +47170,6 @@ resolve@^2.0.0-next.3:
languageName: node
linkType: hard
-"webpack-merge-and-include-globally@npm:^2.3.4":
- version: 2.3.4
- resolution: "webpack-merge-and-include-globally@npm:2.3.4"
- dependencies:
- es6-promisify: ^6.1.1
- glob: ^7.1.6
- rev-hash: ^3.0.0
- peerDependencies:
- webpack: ">=1.0.0"
- checksum: 00e99409653303ef9e99ba9f622a35f890110932d6feecaa65779f2bf8237a892ac5905bb4a4ea4fd41dd2e584461ee9de4f366e7ce307737e9c0e5b9693fe39
- languageName: node
- linkType: hard
-
"webpack-merge@npm:^5.7.3":
version: 5.7.3
resolution: "webpack-merge@npm:5.7.3"