Skip to content

Commit 6042a0b

Browse files
committed
fix ci e2e and button loading width
1 parent 2499ce8 commit 6042a0b

3 files changed

Lines changed: 29 additions & 15 deletions

File tree

e2e/seo.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ test("public listing pages expose crawlable listing metadata", async ({
221221
);
222222
});
223223

224-
test("anonymous residential listing pages expose an indexable private-host teaser", async ({
224+
test("anonymous residential listing pages expose indexable public content without identity or media", async ({
225225
page,
226226
}) => {
227227
await page.goto(RESIDENTIAL_LISTING_PATH, { waitUntil: "domcontentloaded" });
@@ -239,19 +239,22 @@ test("anonymous residential listing pages expose an indexable private-host tease
239239
await expect(
240240
page.getByRole("heading", { name: "Private Host" })
241241
).toBeVisible();
242-
await expect(page.getByText("Resident of Newtown")).toBeVisible();
242+
await expect(
243+
page.getByText("Resident of Newtown", { exact: true })
244+
).toBeVisible();
245+
await expect(page.getByText("A small residential setup")).toBeVisible();
246+
await expect(page.getByText("Fruit scraps", { exact: true })).toBeVisible();
247+
await expect(page.getByText("Paper towels", { exact: true })).toBeVisible();
248+
await expect(
249+
page.getByText("Crushed egg shells", { exact: true })
250+
).toBeVisible();
243251

244252
const pageHtml = await page.content();
245253
for (const privateText of [
246254
"Newtown Balcony Worm Farm",
247-
"A small residential setup",
248-
"Fruit scraps",
249-
"Paper towels",
250-
"Crushed egg shells",
251-
"Citrus in bulk",
252-
"Cooked food",
253-
"151.1781",
254-
"-33.8986",
255+
"9a0c62fc-bf50-4f45-ba6c-5b9051c2712a",
256+
"demo/sunflowers.jpg",
257+
"Riley",
255258
]) {
256259
expect(pageHtml).not.toContain(privateText);
257260
}

src/app/(forms)/profile/reset-password/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default async function ResetPassword(props: {
7373
{searchParams.error && (
7474
<FormMessage message={{ error: searchParams.error }} />
7575
)}
76-
<SubmitButton pendingText={t("Status.resetting")}>
76+
<SubmitButton fullWidth pendingText={t("Status.resetting")}>
7777
{t("Actions.resetPassword")}
7878
</SubmitButton>
7979
</Form>

src/components/Button/Button.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type ButtonStyleProps = {
1919
variant?: ButtonVariant;
2020
size?: ButtonSize;
2121
width?: ButtonWidth;
22+
fullWidth?: boolean;
2223
disabled?: boolean;
2324
};
2425

@@ -108,6 +109,11 @@ type LinkButtonRestProps = Omit<
108109
const isLinkButton = (props: ButtonProps): props is LinkButtonProps =>
109110
props.href !== undefined;
110111

112+
const getResolvedWidth = (
113+
width: ButtonWidth | undefined,
114+
fullWidth: boolean | undefined
115+
) => (fullWidth ? "full" : width);
116+
111117
const getCommonProps = (props: ButtonProps) => {
112118
const {
113119
variant = "secondary",
@@ -117,10 +123,13 @@ const getCommonProps = (props: ButtonProps) => {
117123
loading = false,
118124
loadingText = "Loading...",
119125
size = "normal",
126+
width,
127+
fullWidth,
120128
onClick,
121129
href,
122130
...restProps
123131
} = props;
132+
const resolvedWidth = getResolvedWidth(width, fullWidth);
124133

125134
return {
126135
variant,
@@ -130,6 +139,7 @@ const getCommonProps = (props: ButtonProps) => {
130139
loading,
131140
loadingText,
132141
size,
142+
width: resolvedWidth,
133143
onClick,
134144
href,
135145
restProps,
@@ -388,6 +398,7 @@ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
388398
loading,
389399
loadingText,
390400
size,
401+
width,
391402
onClick,
392403
restProps,
393404
} = getCommonProps(allProps);
@@ -416,13 +427,13 @@ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
416427
href={allProps.href}
417428
ref={ref as Ref<HTMLAnchorElement>}
418429
$variant={variant}
419-
$width={allProps.width}
430+
$width={width}
420431
$size={size}
421432
$disabledState={isDisabled}
422433
tabIndex={isDisabled ? -1 : tabIndex}
423434
aria-disabled={isDisabled || undefined}
424435
aria-busy={isLoading || undefined}
425-
data-button-width={allProps.width ?? "contained"}
436+
data-button-width={width ?? "contained"}
426437
{...clickProps}
427438
{...linkProps}
428439
rel={rel}
@@ -442,13 +453,13 @@ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
442453
ref={ref as Ref<HTMLButtonElement>}
443454
disabled={isDisabled}
444455
$variant={variant}
445-
$width={allProps.width}
456+
$width={width}
446457
$size={size}
447458
$disabledState={isDisabled}
448459
tabIndex={isDisabled ? -1 : tabIndex}
449460
aria-disabled={isDisabled || undefined}
450461
aria-busy={isLoading || undefined}
451-
data-button-width={allProps.width ?? "contained"}
462+
data-button-width={width ?? "contained"}
452463
onClick={onClick}
453464
{...buttonProps}
454465
>

0 commit comments

Comments
 (0)