Skip to content

Commit

Permalink
Merge branch 'main' into MNTOR-3897-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mansaj authored Feb 3, 2025
2 parents 93f3183 + e23ea49 commit 9151b57
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 205 deletions.
2 changes: 1 addition & 1 deletion locales/sk/settings.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ settings-page-title = Nastavenia { -product-short-name(case: "gen") }
## Breach alert preferences

settings-alert-email-preferences-title = Predvoľby e-mailov
settings-alert-email-preferences-title = Predvoľby emailov
settings-alert-email-preferences-subtitle = Povedzte nám, aké e‑maily chcete dostávať.
settings-alert-preferences-allow-breach-alerts-title = Okamžité upozornenia na únik
settings-alert-preferences-allow-breach-alerts-subtitle = Tieto upozornenia sa odosielajú okamžite po zistení úniku údajov
Expand Down
328 changes: 165 additions & 163 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@
"@faker-js/faker": "^9.4.0",
"@google-cloud/bigquery": "^7.9.1",
"@playwright/test": "^1.50.0",
"@storybook/addon-a11y": "^8.5.2",
"@storybook/addon-actions": "^8.5.2",
"@storybook/addon-essentials": "^8.5.2",
"@storybook/addon-interactions": "^8.5.2",
"@storybook/addon-links": "^8.5.2",
"@storybook/nextjs": "^8.5.2",
"@storybook/react": "^8.5.2",
"@storybook/addon-a11y": "^8.5.3",
"@storybook/addon-actions": "^8.5.3",
"@storybook/addon-essentials": "^8.5.3",
"@storybook/addon-interactions": "^8.5.3",
"@storybook/addon-links": "^8.5.3",
"@storybook/nextjs": "^8.5.3",
"@storybook/react": "^8.5.3",
"@storybook/test": "^8.5.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ it("includes a link to the terms on the renewal page", () => {

it("confirms the renewal after it's applied", async () => {
const user = userEvent.setup();
const applyCouponPromise = new Promise((resolve) => {
resolve({
success: true,
});
});
const PlusExpirationView = composeStory(HappyPath, Meta);
render(
<PlusExpirationView
applyCouponAction={jest.fn().mockResolvedValue({ success: true })}
applyCouponAction={jest.fn().mockReturnValue(applyCouponPromise)}
/>,
);

Expand All @@ -49,6 +54,7 @@ it("confirms the renewal after it's applied", async () => {
name: "Renew subscription",
});
await user.click(renewalButton);
await applyCouponPromise;

expect(
screen.getByRole("heading", {
Expand All @@ -59,16 +65,20 @@ it("confirms the renewal after it's applied", async () => {

it("shows an error if applying the coupon failed", async () => {
const user = userEvent.setup();
const applyCouponPromise = new Promise((resolve) => {
resolve({
success: false,
error: "apply_renewal_coupon_error",
});
});
const PlusExpirationView = composeStory(HappyPath, Meta);
render(
<PlusExpirationView
applyCouponAction={jest.fn().mockResolvedValue({
success: false,
error: "apply_renewal_coupon_error",
})}
applyCouponAction={jest.fn().mockReturnValue(applyCouponPromise)}
/>,
);

await applyCouponPromise;
expect(
screen.queryByText(/Couldnt renew subscription./),
).not.toBeInTheDocument();
Expand All @@ -83,20 +93,24 @@ it("shows an error if applying the coupon failed", async () => {

it("hides the error after dismissing it", async () => {
const user = userEvent.setup();
const applyCouponErrorPromise = new Promise((resolve) => {
resolve({
success: false,
error: "apply_renewal_coupon_error",
});
});
const PlusExpirationView = composeStory(HappyPath, Meta);
render(
<PlusExpirationView
applyCouponAction={jest.fn().mockResolvedValue({
success: false,
error: "apply_renewal_coupon_error",
})}
applyCouponAction={jest.fn().mockReturnValue(applyCouponErrorPromise)}
/>,
);

const renewalButton = screen.getByRole("button", {
name: "Renew subscription",
});
await user.click(renewalButton);
await applyCouponErrorPromise;

expect(screen.getByText(/Couldnt renew subscription./)).toBeInTheDocument();

Expand All @@ -110,27 +124,37 @@ it("hides the error after dismissing it", async () => {
it("allows retrying after an error", async () => {
const user = userEvent.setup();
const PlusExpirationView = composeStory(HappyPath, Meta);
const applyCouponErrorPromise = new Promise((resolve) => {
resolve({
success: false,
error: "apply_renewal_coupon_error",
});
});
const applyCouponSuccessPromise = new Promise((resolve) => {
resolve({
success: true,
});
});
render(
<PlusExpirationView
applyCouponAction={jest
.fn()
.mockResolvedValueOnce({
success: false,
error: "apply_renewal_coupon_error",
})
.mockResolvedValueOnce({ success: true })}
.mockReturnValueOnce(applyCouponErrorPromise)
.mockReturnValueOnce(applyCouponSuccessPromise)}
/>,
);

const renewalButton = screen.getByRole("button", {
name: "Renew subscription",
});
await user.click(renewalButton);
await applyCouponErrorPromise;

expect(screen.getByText(/Couldnt renew subscription./)).toBeInTheDocument();

const retryButton = screen.getByRole("button", { name: "Try again" });
await user.click(retryButton);
await applyCouponSuccessPromise;
expect(
screen.queryByText(/Couldnt renew subscription./),
).not.toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const RenewalShell = (props: Props) => {
<Image
src={monitorLogo}
alt={l10n.getString("plus-expiration-header-logo-alt")}
height={32}
/>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
padding-block-end: tokens.$spacing-md;
text-align: center;

h1 {
font: tokens.$text-title-xs;
.content {
display: flex;
flex-direction: column;
gap: tokens.$spacing-sm;

h1 {
font: tokens.$text-title-xs;

b {
color: tokens.$color-purple-70;
b {
color: tokens.$color-purple-70;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ export const View = (props: Props) => {
</>
) : (
<>
<h1>
{l10n.getFragment("plus-expiration-intro-heading", {
elems: { b: <b /> },
})}
</h1>
<p>{l10n.getString("plus-expiration-intro-content")}</p>
<div className={styles.content}>
<h1>
{l10n.getFragment("plus-expiration-intro-heading", {
elems: { b: <b /> },
})}
</h1>
<p>{l10n.getString("plus-expiration-intro-content")}</p>
</div>
{applyCouponState.error &&
applyCouponState.error !== "not_applied_yet" &&
!isApplyCouponPending &&
Expand Down Expand Up @@ -181,16 +183,16 @@ export const View = (props: Props) => {
>
{l10n.getString("plus-expiration-intro-cta-label")}
</Button>
<p className={styles.terms}>
<Link href="/terms/expiration-offer" target="_blank">
{l10n.getString("plus-expiration-intro-terms")}
<OpenInNew
alt={l10n.getString("open-in-new-tab-alt")}
width={13}
/>
</Link>
</p>
</div>
<p className={styles.terms}>
<Link href="/terms/expiration-offer" target="_blank">
{l10n.getString("plus-expiration-intro-terms")}
<OpenInNew
alt={l10n.getString("open-in-new-tab-alt")}
width={13}
/>
</Link>
</p>
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const View = (props: Props) => {
<li>{l10n.getString("plus-expiration-terms-term5")}</li>
<li>
{l10n.getFragment("plus-expiration-terms-term6", {
elems: { "monitor-link": <Link href="/" /> },
elems: { "monitor-link": <Link href="/#pricing" /> },
})}
</li>
</ul>
Expand Down

0 comments on commit 9151b57

Please sign in to comment.