@transferwise/components 0.0.0-experimental-a9c89de → 0.0.0-experimental-b6ae643
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/liveRegion/LiveRegion.js +7 -46
- package/build/common/liveRegion/LiveRegion.js.map +1 -1
- package/build/common/liveRegion/LiveRegion.mjs +7 -46
- package/build/common/liveRegion/LiveRegion.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +0 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +0 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/main.css +69 -5
- package/build/overlayHeader/OverlayHeader.js +0 -1
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +0 -1
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js +0 -2
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +0 -2
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/styles/css/neptune.css +69 -1
- package/build/styles/fonts/WiseSansJP-Heavy.woff2 +0 -0
- package/build/styles/main.css +69 -5
- package/build/styles/styles/less/neptune.css +69 -1
- package/build/types/common/liveRegion/LiveRegion.d.ts +2 -5
- package/build/types/common/liveRegion/LiveRegion.d.ts.map +1 -1
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common/liveRegion/LiveRegion.test.tsx +2 -69
- package/src/common/liveRegion/LiveRegion.tsx +8 -77
- package/src/display/Display.story.tsx +15 -1
- package/src/main.css +69 -5
- package/src/main.less +0 -1
- package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +5 -142
- package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +6 -11
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +1 -2
- package/src/styles/fonts/WiseSansJP-Heavy.woff2 +0 -0
- package/src/styles/less/core/_fonts.less +13 -0
- package/src/styles/less/core/_typography.less +16 -2
- package/src/styles/less/neptune.css +69 -1
- package/build/styles/common/liveRegion/LiveRegion.css +0 -3
- package/src/common/liveRegion/LiveRegion.css +0 -3
- package/src/common/liveRegion/LiveRegion.less +0 -3
package/src/main.css
CHANGED
|
@@ -2334,6 +2334,18 @@
|
|
|
2334
2334
|
src: url("styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
|
+
/**
|
|
2338
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
@font-face {
|
|
2342
|
+
font-family: 'Wise Sans';
|
|
2343
|
+
font-style: normal;
|
|
2344
|
+
font-display: swap;
|
|
2345
|
+
src: url("styles/fonts/WiseSansJP-Heavy.woff2") format('woff2');
|
|
2346
|
+
unicode-range: U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605, U+2606, U+2190-2195, U+203B;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2337
2349
|
/* stylelint-disable selector-max-empty-lines */
|
|
2338
2350
|
|
|
2339
2351
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
@@ -3492,10 +3504,66 @@ a,
|
|
|
3492
3504
|
.np-text-display-large,
|
|
3493
3505
|
.np-text-display-medium,
|
|
3494
3506
|
.np-text-display-small {
|
|
3495
|
-
font-family:
|
|
3507
|
+
font-family: 'Wise Sans', 'Inter', sans-serif;
|
|
3508
|
+
font-family: var(--font-family-display);
|
|
3496
3509
|
font-synthesis: none;
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
:lang(ja) .display-1,
|
|
3513
|
+
:lang(ja) .display-2,
|
|
3514
|
+
:lang(ja) .display-3,
|
|
3515
|
+
:lang(ja) .display-4,
|
|
3516
|
+
:lang(ja) .display-5,
|
|
3517
|
+
:lang(ja) .np-text-display-extra-large,
|
|
3518
|
+
:lang(ja) .np-text-display-large,
|
|
3519
|
+
:lang(ja) .np-text-display-medium,
|
|
3520
|
+
:lang(ja) .np-text-display-small,
|
|
3521
|
+
:lang(id) .display-1,
|
|
3522
|
+
:lang(id) .display-2,
|
|
3523
|
+
:lang(id) .display-3,
|
|
3524
|
+
:lang(id) .display-4,
|
|
3525
|
+
:lang(id) .display-5,
|
|
3526
|
+
:lang(id) .np-text-display-extra-large,
|
|
3527
|
+
:lang(id) .np-text-display-large,
|
|
3528
|
+
:lang(id) .np-text-display-medium,
|
|
3529
|
+
:lang(id) .np-text-display-small,
|
|
3530
|
+
:lang(th) .display-1,
|
|
3531
|
+
:lang(th) .display-2,
|
|
3532
|
+
:lang(th) .display-3,
|
|
3533
|
+
:lang(th) .display-4,
|
|
3534
|
+
:lang(th) .display-5,
|
|
3535
|
+
:lang(th) .np-text-display-extra-large,
|
|
3536
|
+
:lang(th) .np-text-display-large,
|
|
3537
|
+
:lang(th) .np-text-display-medium,
|
|
3538
|
+
:lang(th) .np-text-display-small,
|
|
3539
|
+
:lang(zh-CN) .display-1,
|
|
3540
|
+
:lang(zh-CN) .display-2,
|
|
3541
|
+
:lang(zh-CN) .display-3,
|
|
3542
|
+
:lang(zh-CN) .display-4,
|
|
3543
|
+
:lang(zh-CN) .display-5,
|
|
3544
|
+
:lang(zh-CN) .np-text-display-extra-large,
|
|
3545
|
+
:lang(zh-CN) .np-text-display-large,
|
|
3546
|
+
:lang(zh-CN) .np-text-display-medium,
|
|
3547
|
+
:lang(zh-CN) .np-text-display-small,
|
|
3548
|
+
:lang(zh-HK) .display-1,
|
|
3549
|
+
:lang(zh-HK) .display-2,
|
|
3550
|
+
:lang(zh-HK) .display-3,
|
|
3551
|
+
:lang(zh-HK) .display-4,
|
|
3552
|
+
:lang(zh-HK) .display-5,
|
|
3553
|
+
:lang(zh-HK) .np-text-display-extra-large,
|
|
3554
|
+
:lang(zh-HK) .np-text-display-large,
|
|
3555
|
+
:lang(zh-HK) .np-text-display-medium,
|
|
3556
|
+
:lang(zh-HK) .np-text-display-small {
|
|
3557
|
+
/**
|
|
3558
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
3559
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
3560
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
3561
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
3562
|
+
*/
|
|
3563
|
+
font-family: 'Inter', Helvetica, Arial, sans-serif;
|
|
3564
|
+
font-family: var(--font-family-regular);
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3499
3567
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
3500
3568
|
|
|
3501
3569
|
.np-text-display-extra-large,
|
|
@@ -28096,10 +28164,6 @@ a[data-toggle="tooltip"] {
|
|
|
28096
28164
|
--Card-padding: var(--size-16);
|
|
28097
28165
|
}
|
|
28098
28166
|
|
|
28099
|
-
.wds-LiveRegion {
|
|
28100
|
-
width: 100%;
|
|
28101
|
-
}
|
|
28102
|
-
|
|
28103
28167
|
.np-bottom-sheet {
|
|
28104
28168
|
border-radius: 10px 10px 0 0;
|
|
28105
28169
|
}
|
package/src/main.less
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
@import "./circularButton/CircularButton.less";
|
|
23
23
|
@import "./common/circle/Circle.less";
|
|
24
24
|
@import "./common/baseCard/BaseCard.less";
|
|
25
|
-
@import "./common/liveRegion/LiveRegion.less";
|
|
26
25
|
@import "./common/bottomSheet/BottomSheet.less";
|
|
27
26
|
@import "./common/closeButton/CloseButton.less";
|
|
28
27
|
@import "./common/Option/Option.less";
|
|
@@ -40,6 +40,7 @@ const wait = async (duration = 500) =>
|
|
|
40
40
|
export const DismissInteraction: Story = {
|
|
41
41
|
play: async ({ canvasElement, step }) => {
|
|
42
42
|
const canvas = within(canvasElement);
|
|
43
|
+
const dismissButton = canvas.getByRole('button', { name: /close/i });
|
|
43
44
|
|
|
44
45
|
await step('Verify prompt is visible', async () => {
|
|
45
46
|
await waitFor(async () =>
|
|
@@ -48,7 +49,6 @@ export const DismissInteraction: Story = {
|
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
await step('Click the dismiss button', async () => {
|
|
51
|
-
const dismissButton = canvas.getByRole('button', { name: /close/i, hidden: true });
|
|
52
52
|
await userEvent.click(dismissButton);
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -120,6 +120,7 @@ export const DismissViaKeyboard: Story = {
|
|
|
120
120
|
export const ActionClickInteraction: Story = {
|
|
121
121
|
play: async ({ canvasElement, step }) => {
|
|
122
122
|
const canvas = within(canvasElement);
|
|
123
|
+
const actionLink = canvas.getByRole('link', { name: 'Learn more' });
|
|
123
124
|
|
|
124
125
|
await step('Verify prompt with action is visible', async () => {
|
|
125
126
|
await waitFor(async () =>
|
|
@@ -128,7 +129,6 @@ export const ActionClickInteraction: Story = {
|
|
|
128
129
|
});
|
|
129
130
|
|
|
130
131
|
await step('Click the action link', async () => {
|
|
131
|
-
const actionLink = await waitFor(() => canvas.getByRole('link', { name: 'Learn more' }));
|
|
132
132
|
await userEvent.click(actionLink);
|
|
133
133
|
});
|
|
134
134
|
|
|
@@ -165,6 +165,7 @@ export const ActionClickInteraction: Story = {
|
|
|
165
165
|
export const MultipleDismissInteraction: Story = {
|
|
166
166
|
play: async ({ canvasElement, step }) => {
|
|
167
167
|
const canvas = within(canvasElement);
|
|
168
|
+
const dismissButtons = canvas.getAllByRole('button', { name: /close/i });
|
|
168
169
|
|
|
169
170
|
await step('Verify all prompts are visible', async () => {
|
|
170
171
|
await waitFor(async () => {
|
|
@@ -176,7 +177,6 @@ export const MultipleDismissInteraction: Story = {
|
|
|
176
177
|
|
|
177
178
|
await step('Dismiss the warning prompt', async () => {
|
|
178
179
|
// Click the second dismiss button (warning)
|
|
179
|
-
const dismissButtons = canvas.getAllByRole('button', { name: /close/i, hidden: true });
|
|
180
180
|
await userEvent.click(dismissButtons[1]);
|
|
181
181
|
});
|
|
182
182
|
|
|
@@ -220,13 +220,13 @@ export const MultipleDismissInteraction: Story = {
|
|
|
220
220
|
export const TouchInteraction: Story = {
|
|
221
221
|
play: async ({ canvasElement, step }) => {
|
|
222
222
|
const canvas = within(canvasElement);
|
|
223
|
+
const actionLink = canvas.getByRole('link', { name: 'Navigate' });
|
|
223
224
|
|
|
224
225
|
await step('Verify prompt with action is visible', async () => {
|
|
225
226
|
await waitFor(async () => expect(canvas.getByText('Tap the prompt.')).toBeInTheDocument());
|
|
226
227
|
});
|
|
227
228
|
|
|
228
229
|
await step('Click the action (simulating touch)', async () => {
|
|
229
|
-
const actionLink = await waitFor(() => canvas.getByRole('link', { name: 'Navigate' }));
|
|
230
230
|
await userEvent.click(actionLink);
|
|
231
231
|
});
|
|
232
232
|
|
|
@@ -352,143 +352,6 @@ export const LiveRegionAssertive: Story = {
|
|
|
352
352
|
},
|
|
353
353
|
};
|
|
354
354
|
|
|
355
|
-
/**
|
|
356
|
-
* Test that a polite InfoPrompt added to the DOM gets a delayed live region.
|
|
357
|
-
*/
|
|
358
|
-
export const LiveRegionPoliteWhenAddedToDom: Story = {
|
|
359
|
-
play: async ({ canvasElement, step }) => {
|
|
360
|
-
const canvas = within(canvasElement);
|
|
361
|
-
|
|
362
|
-
await step('Verify prompt is not in the DOM before trigger', async () => {
|
|
363
|
-
await expect(canvas.queryByText('Polite prompt added later')).not.toBeInTheDocument();
|
|
364
|
-
await expect(canvas.queryByRole('status')).not.toBeInTheDocument();
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
await step('Add two prompts to the DOM', async () => {
|
|
368
|
-
const addButton = canvas.getByRole('button', { name: 'Add polite prompt' });
|
|
369
|
-
await userEvent.click(addButton);
|
|
370
|
-
await userEvent.click(addButton);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
await step('Verify delayed polite live regions appear with content', async () => {
|
|
374
|
-
await expect(canvas.getByText('Polite prompt added later 1')).toBeInTheDocument();
|
|
375
|
-
await expect(canvas.getByText('Polite prompt added later 2')).toBeInTheDocument();
|
|
376
|
-
const initialLiveRegions = canvas.queryAllByRole('status');
|
|
377
|
-
await expect(initialLiveRegions).toHaveLength(2);
|
|
378
|
-
await expect(initialLiveRegions[0].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
379
|
-
await expect(initialLiveRegions[1].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
380
|
-
|
|
381
|
-
await waitFor(async () => {
|
|
382
|
-
const liveRegions = canvas.getAllByRole('status');
|
|
383
|
-
await expect(liveRegions).toHaveLength(2);
|
|
384
|
-
await expect(liveRegions[0]).toHaveAttribute('aria-live', 'polite');
|
|
385
|
-
await expect(liveRegions[1]).toHaveAttribute('aria-live', 'polite');
|
|
386
|
-
await expect(liveRegions[0]).toHaveAttribute('aria-atomic', 'true');
|
|
387
|
-
await expect(liveRegions[1]).toHaveAttribute('aria-atomic', 'true');
|
|
388
|
-
await expect(liveRegions[0].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
389
|
-
await expect(liveRegions[1].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
390
|
-
await expect(
|
|
391
|
-
within(liveRegions[0]).getByText('Polite prompt added later 1'),
|
|
392
|
-
).toBeInTheDocument();
|
|
393
|
-
await expect(
|
|
394
|
-
within(liveRegions[1]).getByText('Polite prompt added later 2'),
|
|
395
|
-
).toBeInTheDocument();
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
},
|
|
399
|
-
render: function Render(args: InfoPromptProps) {
|
|
400
|
-
const [promptIndexes, setPromptIndexes] = useState<number[]>([]);
|
|
401
|
-
|
|
402
|
-
const addPrompt = () => {
|
|
403
|
-
setPromptIndexes((previousIndexes) => [...previousIndexes, previousIndexes.length + 1]);
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
return (
|
|
407
|
-
<>
|
|
408
|
-
<button type="button" onClick={addPrompt}>
|
|
409
|
-
Add polite prompt
|
|
410
|
-
</button>
|
|
411
|
-
{promptIndexes.map((promptIndex) => (
|
|
412
|
-
<InfoPrompt
|
|
413
|
-
key={`polite-${promptIndex}`}
|
|
414
|
-
{...args}
|
|
415
|
-
description={`Polite prompt added later ${promptIndex}`}
|
|
416
|
-
/>
|
|
417
|
-
))}
|
|
418
|
-
</>
|
|
419
|
-
);
|
|
420
|
-
},
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Test that an assertive InfoPrompt added to the DOM gets a delayed live region.
|
|
425
|
-
*/
|
|
426
|
-
export const LiveRegionAssertiveWhenAddedToDom: Story = {
|
|
427
|
-
play: async ({ canvasElement, step }) => {
|
|
428
|
-
const canvas = within(canvasElement);
|
|
429
|
-
|
|
430
|
-
await step('Verify prompt is not in the DOM before trigger', async () => {
|
|
431
|
-
await expect(canvas.queryByText('Assertive prompt added later')).not.toBeInTheDocument();
|
|
432
|
-
await expect(canvas.queryByRole('alert')).not.toBeInTheDocument();
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
await step('Add two prompts to the DOM', async () => {
|
|
436
|
-
const addButton = canvas.getByRole('button', { name: 'Add assertive prompt' });
|
|
437
|
-
await userEvent.click(addButton);
|
|
438
|
-
await userEvent.click(addButton);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
await step('Verify delayed assertive live regions appear with content', async () => {
|
|
442
|
-
await expect(canvas.getByText('Assertive prompt added later 1')).toBeInTheDocument();
|
|
443
|
-
await expect(canvas.getByText('Assertive prompt added later 2')).toBeInTheDocument();
|
|
444
|
-
const initialLiveRegions = canvas.queryAllByRole('alert');
|
|
445
|
-
await expect(initialLiveRegions).toHaveLength(2);
|
|
446
|
-
await expect(initialLiveRegions[0].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
447
|
-
await expect(initialLiveRegions[1].firstElementChild).toHaveAttribute('aria-hidden', 'true');
|
|
448
|
-
|
|
449
|
-
await waitFor(async () => {
|
|
450
|
-
const liveRegions = canvas.getAllByRole('alert');
|
|
451
|
-
await expect(liveRegions).toHaveLength(2);
|
|
452
|
-
await expect(liveRegions[0]).toHaveAttribute('aria-live', 'assertive');
|
|
453
|
-
await expect(liveRegions[1]).toHaveAttribute('aria-live', 'assertive');
|
|
454
|
-
await expect(liveRegions[0]).toHaveAttribute('aria-atomic', 'true');
|
|
455
|
-
await expect(liveRegions[1]).toHaveAttribute('aria-atomic', 'true');
|
|
456
|
-
await expect(liveRegions[0].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
457
|
-
await expect(liveRegions[1].firstElementChild).not.toHaveAttribute('aria-hidden');
|
|
458
|
-
await expect(
|
|
459
|
-
within(liveRegions[0]).getByText('Assertive prompt added later 1'),
|
|
460
|
-
).toBeInTheDocument();
|
|
461
|
-
await expect(
|
|
462
|
-
within(liveRegions[1]).getByText('Assertive prompt added later 2'),
|
|
463
|
-
).toBeInTheDocument();
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
},
|
|
467
|
-
render: function Render(args: InfoPromptProps) {
|
|
468
|
-
const [promptIndexes, setPromptIndexes] = useState<number[]>([]);
|
|
469
|
-
|
|
470
|
-
const addPrompt = () => {
|
|
471
|
-
setPromptIndexes((previousIndexes) => [...previousIndexes, previousIndexes.length + 1]);
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
return (
|
|
475
|
-
<>
|
|
476
|
-
<button type="button" onClick={addPrompt}>
|
|
477
|
-
Add assertive prompt
|
|
478
|
-
</button>
|
|
479
|
-
{promptIndexes.map((promptIndex) => (
|
|
480
|
-
<InfoPrompt
|
|
481
|
-
key={`assertive-${promptIndex}`}
|
|
482
|
-
{...args}
|
|
483
|
-
description={`Assertive prompt added later ${promptIndex}`}
|
|
484
|
-
aria-live="assertive"
|
|
485
|
-
/>
|
|
486
|
-
))}
|
|
487
|
-
</>
|
|
488
|
-
);
|
|
489
|
-
},
|
|
490
|
-
};
|
|
491
|
-
|
|
492
355
|
/**
|
|
493
356
|
* Test that aria-live="off" renders without a live region wrapper.
|
|
494
357
|
*/
|
|
@@ -527,7 +390,7 @@ export const LiveRegionDismiss: Story = {
|
|
|
527
390
|
});
|
|
528
391
|
|
|
529
392
|
await step('Dismiss the prompt', async () => {
|
|
530
|
-
const dismissButton = canvas.getByRole('button', { name: /close/i
|
|
393
|
+
const dismissButton = canvas.getByRole('button', { name: /close/i });
|
|
531
394
|
await userEvent.click(dismissButton);
|
|
532
395
|
});
|
|
533
396
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { fireEvent, mockMatchMedia, render, screen, userEvent
|
|
2
|
-
import { resetLiveRegionAnnouncementQueue } from '../../common/liveRegion/LiveRegion';
|
|
1
|
+
import { fireEvent, mockMatchMedia, render, screen, userEvent } from '../../test-utils';
|
|
3
2
|
import { InfoPrompt, InfoPromptProps } from './InfoPrompt';
|
|
4
3
|
|
|
5
4
|
mockMatchMedia();
|
|
@@ -11,10 +10,6 @@ describe('InfoPrompt', () => {
|
|
|
11
10
|
description: 'Prompt description',
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
resetLiveRegionAnnouncementQueue();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
13
|
it('renders description', () => {
|
|
19
14
|
render(<InfoPrompt {...defaultProps} />);
|
|
20
15
|
expect(screen.getByText('Prompt description')).toBeInTheDocument();
|
|
@@ -64,23 +59,23 @@ describe('InfoPrompt', () => {
|
|
|
64
59
|
});
|
|
65
60
|
|
|
66
61
|
describe('action', () => {
|
|
67
|
-
it('should render action link when action is provided with href',
|
|
62
|
+
it('should render action link when action is provided with href', () => {
|
|
68
63
|
render(
|
|
69
64
|
<InfoPrompt {...defaultProps} action={{ label: 'Learn more', href: '/learn-more' }} />,
|
|
70
65
|
);
|
|
71
|
-
const actionLink =
|
|
66
|
+
const actionLink = screen.getByRole('link', { name: 'Learn more' });
|
|
72
67
|
expect(actionLink).toBeInTheDocument();
|
|
73
68
|
expect(actionLink).toHaveAttribute('href', '/learn-more');
|
|
74
69
|
});
|
|
75
70
|
|
|
76
|
-
it('should render action link with target when provided',
|
|
71
|
+
it('should render action link with target when provided', () => {
|
|
77
72
|
render(
|
|
78
73
|
<InfoPrompt
|
|
79
74
|
{...defaultProps}
|
|
80
75
|
action={{ label: 'External link', href: 'https://example.com', target: '_blank' }}
|
|
81
76
|
/>,
|
|
82
77
|
);
|
|
83
|
-
const actionLink =
|
|
78
|
+
const actionLink = screen.getByRole('link', { name: /External link/i });
|
|
84
79
|
expect(actionLink).toHaveAttribute('target', '_blank');
|
|
85
80
|
});
|
|
86
81
|
|
|
@@ -88,7 +83,7 @@ describe('InfoPrompt', () => {
|
|
|
88
83
|
const user = userEvent.setup();
|
|
89
84
|
const onClick = jest.fn();
|
|
90
85
|
render(<InfoPrompt {...defaultProps} action={{ label: 'Click me', onClick }} />);
|
|
91
|
-
const actionButton =
|
|
86
|
+
const actionButton = screen.getByRole('button', { name: 'Click me' });
|
|
92
87
|
await user.click(actionButton);
|
|
93
88
|
expect(onClick).toHaveBeenCalledTimes(1);
|
|
94
89
|
});
|
|
@@ -86,7 +86,6 @@ export const InfoPrompt = ({
|
|
|
86
86
|
...restProps
|
|
87
87
|
}: InfoPromptProps) => {
|
|
88
88
|
const [shouldFire, setShouldFire] = useState<boolean>();
|
|
89
|
-
const announceOnChange = [title, description, action?.label].filter(Boolean).join('|');
|
|
90
89
|
const statusIconSentiment =
|
|
91
90
|
sentiment === 'success'
|
|
92
91
|
? Sentiment.POSITIVE
|
|
@@ -125,7 +124,7 @@ export const InfoPrompt = ({
|
|
|
125
124
|
|
|
126
125
|
// Render content directly in LiveRegion
|
|
127
126
|
return (
|
|
128
|
-
<LiveRegion aria-live={ariaLive}
|
|
127
|
+
<LiveRegion aria-live={ariaLive}>
|
|
129
128
|
<PrimitivePrompt
|
|
130
129
|
sentiment={sentiment}
|
|
131
130
|
media={renderMedia()}
|
|
Binary file
|
|
@@ -95,3 +95,16 @@
|
|
|
95
95
|
font-display: swap;
|
|
96
96
|
src: url("./styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
101
|
+
*/
|
|
102
|
+
@font-face {
|
|
103
|
+
font-family: 'Wise Sans';
|
|
104
|
+
font-style: normal;
|
|
105
|
+
font-display: swap;
|
|
106
|
+
src: url('./styles/fonts/WiseSansJP-Heavy.woff2') format('woff2');
|
|
107
|
+
unicode-range:
|
|
108
|
+
U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605,
|
|
109
|
+
U+2606, U+2190-2195, U+203B;
|
|
110
|
+
}
|
|
@@ -25,7 +25,7 @@ h6,
|
|
|
25
25
|
line-height: var(--line-height-title);
|
|
26
26
|
letter-spacing: 0;
|
|
27
27
|
.np-text-hyphenated;
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
+ p,
|
|
30
30
|
+ ul:not(.list-unstyled),
|
|
31
31
|
+ ol:not(.list-unstyled) {
|
|
@@ -204,8 +204,22 @@ a,
|
|
|
204
204
|
.np-text-display-large,
|
|
205
205
|
.np-text-display-medium,
|
|
206
206
|
.np-text-display-small {
|
|
207
|
-
font-family:
|
|
207
|
+
font-family: var(--font-family-display);
|
|
208
208
|
font-synthesis: none;
|
|
209
|
+
|
|
210
|
+
:lang(ja) &,
|
|
211
|
+
:lang(id) &,
|
|
212
|
+
:lang(th) &,
|
|
213
|
+
:lang(zh-CN) &,
|
|
214
|
+
:lang(zh-HK) &{
|
|
215
|
+
/**
|
|
216
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
217
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
218
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
219
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
220
|
+
*/
|
|
221
|
+
font-family: var(--font-family-regular);
|
|
222
|
+
}
|
|
209
223
|
}
|
|
210
224
|
|
|
211
225
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
@@ -2334,6 +2334,18 @@
|
|
|
2334
2334
|
src: url("styles/fonts/WiseSans-Heavy.woff2") format("woff2");
|
|
2335
2335
|
}
|
|
2336
2336
|
|
|
2337
|
+
/**
|
|
2338
|
+
* 🚨🚨🚨 ONLY FOR TESTING. BE REMOVED BEFORE MERGING 🚨🚨🚨
|
|
2339
|
+
*/
|
|
2340
|
+
|
|
2341
|
+
@font-face {
|
|
2342
|
+
font-family: 'Wise Sans';
|
|
2343
|
+
font-style: normal;
|
|
2344
|
+
font-display: swap;
|
|
2345
|
+
src: url("styles/fonts/WiseSansJP-Heavy.woff2") format('woff2');
|
|
2346
|
+
unicode-range: U+3000-303F, U+3040-309F, U+30A0-30FF, U+FF00-FFEF, U+4E00-9FAF, U+2605, U+2606, U+2190-2195, U+203B;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2337
2349
|
/* stylelint-disable selector-max-empty-lines */
|
|
2338
2350
|
|
|
2339
2351
|
/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
@@ -3492,10 +3504,66 @@ a,
|
|
|
3492
3504
|
.np-text-display-large,
|
|
3493
3505
|
.np-text-display-medium,
|
|
3494
3506
|
.np-text-display-small {
|
|
3495
|
-
font-family:
|
|
3507
|
+
font-family: 'Wise Sans', 'Inter', sans-serif;
|
|
3508
|
+
font-family: var(--font-family-display);
|
|
3496
3509
|
font-synthesis: none;
|
|
3497
3510
|
}
|
|
3498
3511
|
|
|
3512
|
+
:lang(ja) .display-1,
|
|
3513
|
+
:lang(ja) .display-2,
|
|
3514
|
+
:lang(ja) .display-3,
|
|
3515
|
+
:lang(ja) .display-4,
|
|
3516
|
+
:lang(ja) .display-5,
|
|
3517
|
+
:lang(ja) .np-text-display-extra-large,
|
|
3518
|
+
:lang(ja) .np-text-display-large,
|
|
3519
|
+
:lang(ja) .np-text-display-medium,
|
|
3520
|
+
:lang(ja) .np-text-display-small,
|
|
3521
|
+
:lang(id) .display-1,
|
|
3522
|
+
:lang(id) .display-2,
|
|
3523
|
+
:lang(id) .display-3,
|
|
3524
|
+
:lang(id) .display-4,
|
|
3525
|
+
:lang(id) .display-5,
|
|
3526
|
+
:lang(id) .np-text-display-extra-large,
|
|
3527
|
+
:lang(id) .np-text-display-large,
|
|
3528
|
+
:lang(id) .np-text-display-medium,
|
|
3529
|
+
:lang(id) .np-text-display-small,
|
|
3530
|
+
:lang(th) .display-1,
|
|
3531
|
+
:lang(th) .display-2,
|
|
3532
|
+
:lang(th) .display-3,
|
|
3533
|
+
:lang(th) .display-4,
|
|
3534
|
+
:lang(th) .display-5,
|
|
3535
|
+
:lang(th) .np-text-display-extra-large,
|
|
3536
|
+
:lang(th) .np-text-display-large,
|
|
3537
|
+
:lang(th) .np-text-display-medium,
|
|
3538
|
+
:lang(th) .np-text-display-small,
|
|
3539
|
+
:lang(zh-CN) .display-1,
|
|
3540
|
+
:lang(zh-CN) .display-2,
|
|
3541
|
+
:lang(zh-CN) .display-3,
|
|
3542
|
+
:lang(zh-CN) .display-4,
|
|
3543
|
+
:lang(zh-CN) .display-5,
|
|
3544
|
+
:lang(zh-CN) .np-text-display-extra-large,
|
|
3545
|
+
:lang(zh-CN) .np-text-display-large,
|
|
3546
|
+
:lang(zh-CN) .np-text-display-medium,
|
|
3547
|
+
:lang(zh-CN) .np-text-display-small,
|
|
3548
|
+
:lang(zh-HK) .display-1,
|
|
3549
|
+
:lang(zh-HK) .display-2,
|
|
3550
|
+
:lang(zh-HK) .display-3,
|
|
3551
|
+
:lang(zh-HK) .display-4,
|
|
3552
|
+
:lang(zh-HK) .display-5,
|
|
3553
|
+
:lang(zh-HK) .np-text-display-extra-large,
|
|
3554
|
+
:lang(zh-HK) .np-text-display-large,
|
|
3555
|
+
:lang(zh-HK) .np-text-display-medium,
|
|
3556
|
+
:lang(zh-HK) .np-text-display-small {
|
|
3557
|
+
/**
|
|
3558
|
+
* Wise Sans covers extended Latin glyphs for logged-in experiences and a small subset
|
|
3559
|
+
* of Japanese ones for the logged out ones (exposed by the Editorial DS). Unfortunately,
|
|
3560
|
+
* font files are browser-cached and we carried over to launchpad, where it causes issues
|
|
3561
|
+
* for unsupported locales, especially those that share glyphs, like Japanese and Chinese.
|
|
3562
|
+
*/
|
|
3563
|
+
font-family: 'Inter', Helvetica, Arial, sans-serif;
|
|
3564
|
+
font-family: var(--font-family-regular);
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3499
3567
|
/* DEPRECATED(.np-text-display-extra-large): use .np-text-display-large instead */
|
|
3500
3568
|
|
|
3501
3569
|
.np-text-display-extra-large,
|