feat: enhance user interaction with contact details and improved UI elements

Updated the signup and management pages to include clickable email and phone links for better user accessibility. Introduced new styles for roster management, including a collapsible move form for shift changes. Enhanced confirmation messages for cancellations and improved print styles to hide unnecessary elements. Added error handling for the Turnstile widget in the signup dialog, ensuring fallback options are visible when needed. Updated tests to verify the new features and ensure robust functionality across the application.
This commit is contained in:
blake committed 2026-11-02 15:17:51 -06:00
1 parent e6f072dcac
commit 38c08cf872
12 files changed
+236 -71

No files matched your search

+105 -40
View File
@@ -862,13 +862,19 @@ main a:hover {
margin: 0.5rem 0 0; margin: 0.5rem 0 0;
} }
.manage-record:has(.manage-tools) {
padding-top: 4.35rem;
}
.manage-tools { .manage-tools {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
top: 1.05rem; top: 1.05rem;
right: 1.05rem; right: 1.05rem;
left: 1.05rem;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end;
gap: 0.4rem; gap: 0.4rem;
margin: 0; margin: 0;
} }
@@ -878,46 +884,11 @@ main a:hover {
} }
.manage-x { .manage-x {
width: 2.5rem;
height: 2.5rem;
min-height: 2.5rem; min-height: 2.5rem;
padding: 0; padding: 0.4rem 0.95rem;
border-color: var(--hope-border);
background: #fff;
box-shadow: none; box-shadow: none;
} }
.manage-x::before {
background: var(--hope-yellow);
}
.manage-x span {
position: relative;
width: 0.7rem;
height: 0.7rem;
font-size: 0;
}
.manage-x span::before,
.manage-x span::after {
content: "";
position: absolute;
left: 50%;
top: 50%;
width: 0.7rem;
height: 2px;
border-radius: 1px;
background: currentColor;
}
.manage-x span::before {
transform: translate(-50%, -50%) rotate(45deg);
}
.manage-x span::after {
transform: translate(-50%, -50%) rotate(-45deg);
}
.manage-menu { .manage-menu {
position: relative; position: relative;
} }
@@ -3057,6 +3028,45 @@ button.btn-quiet::before {
color: var(--hope-ink); color: var(--hope-ink);
} }
.shift-card a[href^="tel:"],
.shift-card a[href^="mailto:"] {
color: inherit;
font-weight: 650;
text-decoration: underline;
text-underline-offset: 0.12em;
}
.roster-move {
margin-top: 0.75rem;
}
.roster-move:not([open]) > .move-form,
.roster-move:not([open])::details-content {
display: none;
}
.roster-move > summary {
display: inline-flex;
align-items: center;
width: fit-content;
min-height: 2rem;
list-style: none;
cursor: pointer;
color: #4d7494;
font-size: 0.92rem;
font-weight: 650;
text-decoration: underline;
text-underline-offset: 0.12em;
}
.roster-move > summary::-webkit-details-marker {
display: none;
}
.roster-move > .move-form {
margin-top: 0.75rem;
}
.event-page .desk-intro .desk-toolbar { .event-page .desk-intro .desk-toolbar {
align-items: center; align-items: center;
} }
@@ -4341,10 +4351,6 @@ button.btn-quiet::before {
width: 100%; width: 100%;
} }
.manage-record:has(.manage-tools) {
padding-top: 4.35rem;
}
.manage-record:has(.manage-tools) .details { .manage-record:has(.manage-tools) .details {
padding-right: 0; padding-right: 0;
} }
@@ -5831,3 +5837,62 @@ main > .crumb,
flex-wrap: wrap; flex-wrap: wrap;
} }
} }
@media print {
.skip-link,
.header,
.footer,
.session-bar,
.crumb,
.desk-actions,
.desk-inline,
.pick,
.pick-bar,
.notice,
.event-edit,
.walkin-menu,
.roster-move,
.roster-actions,
.signup-form,
.confirm-dialog,
.event-dialog,
button,
.btn {
display: none !important;
}
body,
main,
.event-page,
.shift-card,
article.shift-card,
.desk-events,
.event-strip,
.manage,
.manage-record {
background: #fff;
box-shadow: none;
color: #000;
}
.shift-list {
display: block;
}
.shift-list > li,
li.shift-card {
break-inside: avoid;
margin-bottom: 0.75rem;
border: 1px solid #bbb;
border-radius: 0;
box-shadow: none;
background: #fff;
}
a,
.shift-card a[href^="tel:"],
.shift-card a[href^="mailto:"] {
color: #000;
text-decoration: none;
}
}
+12
View File
@@ -1,4 +1,16 @@
(function () { (function () {
window.addEventListener(
'error',
function (event) {
var target = event.target;
if (!target || !target.src || String(target.src).indexOf('challenges.cloudflare.com/turnstile') === -1) return;
document.querySelectorAll('[data-turnstile-fallback]').forEach(function (node) {
node.hidden = false;
});
},
true,
);
var key = 'hope-place'; var key = 'hope-place';
var place = null; var place = null;
try { try {
+16 -2
View File
@@ -200,14 +200,28 @@
if (!widget || !sitekey) return; if (!widget || !sitekey) return;
loadTurnstile() loadTurnstile()
.then(function () { .then(function () {
if (!widget.isConnected || !window.turnstile) return; if (!widget.isConnected || !window.turnstile) {
showTurnstileFallback(scope);
return;
}
// turnstile.ready() throws when this script is inserted dynamically. // turnstile.ready() throws when this script is inserted dynamically.
try {
widgetId = window.turnstile.render(widget, { widgetId = window.turnstile.render(widget, {
sitekey: sitekey, sitekey: sitekey,
action: widget.getAttribute('data-action') || 'signup', action: widget.getAttribute('data-action') || 'signup',
}); });
} catch (err) {
showTurnstileFallback(scope);
}
}) })
.catch(function () {}); .catch(function () {
showTurnstileFallback(scope);
});
}
function showTurnstileFallback(scope) {
var fallback = scope.querySelector('[data-turnstile-fallback]');
if (fallback) fallback.hidden = false;
} }
function loadTurnstile() { function loadTurnstile() {
+28 -4
View File
@@ -2007,12 +2007,18 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[]
<strong>{person.name}</strong> <strong>{person.name}</strong>
</p> </p>
{person.groupSize > 1 ? <p>Holds {person.groupSize} spots</p> : null} {person.groupSize > 1 ? <p>Holds {person.groupSize} spots</p> : null}
<p>{person.email}</p> <p>
{person.phone ? <p>{person.phone}</p> : null} <a href={`mailto:${person.email}`}>{person.email}</a>
</p>
{person.phone ? (
<p>
<PhoneLink phone={person.phone} />
</p>
) : null}
{person.notes ? <p>Note: {person.notes}</p> : null} {person.notes ? <p>Note: {person.notes}</p> : null}
<p>{person.status === 'confirmed' ? 'Confirmed' : 'Cancelled'}</p> <p>{person.status === 'confirmed' ? 'Confirmed' : 'Cancelled'}</p>
{person.status === 'cancelled' ? ( {person.status === 'cancelled' ? (
<p> <p class="roster-actions">
<ConfirmAnchor <ConfirmAnchor
href={appPath(props.config, `/admin/signups/${person.id}/remove`)} href={appPath(props.config, `/admin/signups/${person.id}/remove`)}
prompt={signupRemovalPrompt({ name: person.name, status: person.status })} prompt={signupRemovalPrompt({ name: person.name, status: person.status })}
@@ -2023,7 +2029,7 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[]
) : null} ) : null}
{person.status === 'confirmed' ? ( {person.status === 'confirmed' ? (
<> <>
<p> <p class="roster-actions">
<ConfirmAnchor <ConfirmAnchor
class="text-action" class="text-action"
href={appPath(props.config, `/admin/signups/${person.id}/cancel`)} href={appPath(props.config, `/admin/signups/${person.id}/cancel`)}
@@ -2033,6 +2039,8 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[]
</ConfirmAnchor> </ConfirmAnchor>
</p> </p>
{props.moves && props.moves.targets.length > 0 && props.moves.tokens[person.id] ? ( {props.moves && props.moves.targets.length > 0 && props.moves.tokens[person.id] ? (
<details class="roster-move">
<summary>Move to another shift</summary>
<form method="post" action={appPath(props.config, `/admin/signups/${person.id}/move`)} class="move-form"> <form method="post" action={appPath(props.config, `/admin/signups/${person.id}/move`)} class="move-form">
<input type="hidden" name="csrf" value={props.csrf} /> <input type="hidden" name="csrf" value={props.csrf} />
<input type="hidden" name="move_token" value={props.moves.tokens[person.id]} /> <input type="hidden" name="move_token" value={props.moves.tokens[person.id]} />
@@ -2044,6 +2052,7 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[]
</label> </label>
<button type="submit">Move</button> <button type="submit">Move</button>
</form> </form>
</details>
) : null} ) : null}
</> </>
) : null} ) : null}
@@ -2053,6 +2062,21 @@ function Roster(props: { config: AppConfig; csrf: string; people: RosterPerson[]
); );
} }
function PhoneLink(props: { phone: string }) {
const href = phoneHref(props.phone);
if (!href) return <>{props.phone}</>;
return <a href={href}>{props.phone}</a>;
}
/** A 10-digit pantry number dials as +1. Anything else keeps the digits it has. */
function phoneHref(phone: string): string | null {
const digits = phone.replace(/\D/g, '');
if (digits.length === 10) return `tel:+1${digits}`;
if (digits.length === 11 && digits.startsWith('1')) return `tel:+${digits}`;
if (digits.length > 0) return `tel:${digits}`;
return null;
}
function LoginForm(props: { config: AppConfig; error?: string }) { function LoginForm(props: { config: AppConfig; error?: string }) {
return ( return (
<> <>
+47 -23
View File
@@ -13,6 +13,9 @@ import { assetHref } from './static-assets.js';
import { appPath } from './url.js'; import { appPath } from './url.js';
const PANTRY_SITE = 'https://hopefoodpantrysc.org'; const PANTRY_SITE = 'https://hopefoodpantrysc.org';
const PANTRY_PHONE_LABEL = '712\u2011540\u20119351';
const PANTRY_PHONE_HREF = 'tel:+17125409351';
const PANTRY_EMAIL = 'hopepantry@gmail.com';
function asset(config: AppConfig, file: string): string { function asset(config: AppConfig, file: string): string {
return assetHref(config, file); return assetHref(config, file);
@@ -136,10 +139,10 @@ export function Layout(props: {
<div class="footer-cell"> <div class="footer-cell">
<h3>Contact Us</h3> <h3>Contact Us</h3>
<p> <p>
<a href="tel:+17125409351">712‑540‑9351</a> <a href={PANTRY_PHONE_HREF}>{PANTRY_PHONE_LABEL}</a>
</p> </p>
<p> <p>
<a href="mailto:hopepantry@gmail.com">hopepantry@gmail.com</a> <a href={`mailto:${PANTRY_EMAIL}`}>{PANTRY_EMAIL}</a>
</p> </p>
<div class="social-links"> <div class="social-links">
<a href="https://www.facebook.com/schopefoodpantry" target="_blank" rel="noopener noreferrer"> <a href="https://www.facebook.com/schopefoodpantry" target="_blank" rel="noopener noreferrer">
@@ -505,7 +508,7 @@ export function ManagePage(props: {
<form id="manage-cancel-form" class="manage-cancel" method="post" action={props.cancel.action}> <form id="manage-cancel-form" class="manage-cancel" method="post" action={props.cancel.action}>
<input type="hidden" name="cancel_token" value={props.cancel.token} /> <input type="hidden" name="cancel_token" value={props.cancel.token} />
<button type="submit" class="manage-x" aria-label="Cancel this signup" aria-haspopup="dialog" data-manage-cancel=""> <button type="submit" class="manage-x" aria-label="Cancel this signup" aria-haspopup="dialog" data-manage-cancel="">
<span aria-hidden="true">×</span> Cancel
</button> </button>
</form> </form>
) : null} ) : null}
@@ -567,8 +570,8 @@ export function ManagePage(props: {
</div> </div>
<p class="hint"> <p class="hint">
{signup.groupSize > 1 {signup.groupSize > 1
? `Opens these ${signup.groupSize} spots, queues a change email, and replaces this link.` ? `This opens these ${signup.groupSize} spots. We'll email a new link, and this one will stop working.`
: 'Opens your spot here, queues a change email, and replaces this link.'} : "This opens your spot here. We'll email a new link, and this one will stop working."}
</p> </p>
</form> </form>
) )
@@ -585,11 +588,7 @@ export function ManagePage(props: {
</button> </button>
</form> </form>
<h2 id="manage-cancel-title">Are you sure you want to cancel?</h2> <h2 id="manage-cancel-title">Are you sure you want to cancel?</h2>
<p> <p>{cancelEffect(signup.groupSize)}</p>
{signup.groupSize > 1
? `Cancel this signup to open these ${signup.groupSize} spots for someone else. A cancellation email is queued when you cancel.`
: 'Cancel this signup to open the spot for someone else. A cancellation email is queued when you cancel.'}
</p>
<div class="confirm-actions"> <div class="confirm-actions">
<button type="submit" form="manage-cancel-form"> <button type="submit" form="manage-cancel-form">
Cancel this signup Cancel this signup
@@ -601,11 +600,7 @@ export function ManagePage(props: {
</div> </div>
</dialog> </dialog>
) : cancelled ? ( ) : cancelled ? (
<p> <p>{cancelledSignupCopy(signup.groupSize)}</p>
{signup.groupSize > 1
? `This signup is cancelled. The ${signup.groupSize} spots it held are open for someone else. A cancellation email is queued.`
: 'This signup is cancelled. The spot is open for someone else. A cancellation email is queued.'}
</p>
) : null} ) : null}
</article> </article>
); );
@@ -717,6 +712,7 @@ type SignupIdentity = {
location: string; location: string;
eventTitle: string; eventTitle: string;
when: ZonedClock; when: ZonedClock;
ends: ZonedClock;
ended: boolean; ended: boolean;
}; };
@@ -730,7 +726,11 @@ function SignupIntro(props: { signup: SignupIdentity }) {
<p>{signup.eventTitle}</p> <p>{signup.eventTitle}</p>
<h2>{signup.role}</h2> <h2>{signup.role}</h2>
<p class="when"> <p class="when">
<time dateTime={signup.when.date}>{signup.when.dateLabel}</time> {signup.when.timeLabel} {signup.when.abbreviation} <time dateTime={signup.when.date}>{signup.when.dateLabel}</time>{' '}
<time dateTime={signup.when.time24}>{signup.when.timeLabel}</time>
{' to '}
{signup.when.date === signup.ends.date ? null : <time dateTime={signup.ends.date}>{signup.ends.dateLabel} </time>}
<time dateTime={signup.ends.time24}>{signup.ends.timeLabel}</time> {signup.when.abbreviation}
</p> </p>
{signup.location ? <p class="location">{signup.location}</p> : null} {signup.location ? <p class="location">{signup.location}</p> : null}
{!cancelled && signup.ended ? <p>This shift has ended.</p> : null} {!cancelled && signup.ended ? <p>This shift has ended.</p> : null}
@@ -792,14 +792,25 @@ function openSpots(groupSize: number): string {
function cancelEffect(groupSize: number): string { function cancelEffect(groupSize: number): string {
return groupSize > 1 return groupSize > 1
? `Cancel this signup to open these ${groupSize} spots for someone else. A cancellation email is queued when you cancel.` ? `Cancel this signup to open these ${groupSize} spots for someone else. We'll email you when it's cancelled.`
: 'Cancel this signup to open the spot for someone else. A cancellation email is queued when you cancel.'; : "Cancel this signup to open the spot for someone else. We'll email you when it's cancelled.";
} }
function cancelledSignupCopy(groupSize: number): string { function cancelledSignupCopy(groupSize: number): string {
return groupSize > 1 return groupSize > 1
? `This signup is cancelled. The ${groupSize} spots it held are open for someone else. A cancellation email is queued.` ? `This signup is cancelled. The ${groupSize} spots it held are open for someone else. A cancellation email is on the way.`
: 'This signup is cancelled. The spot is open for someone else. A cancellation email is queued.'; : 'This signup is cancelled. The spot is open for someone else. A cancellation email is on the way.';
}
function PantryHelp(props: { lead: string }) {
return (
<>
{props.lead} <a href={PANTRY_PHONE_HREF}>{PANTRY_PHONE_LABEL}</a>
{' or email '}
<a href={`mailto:${PANTRY_EMAIL}`}>{PANTRY_EMAIL}</a>
{' if you need help signing up.'}
</>
);
} }
export function NotFoundPage() { export function NotFoundPage() {
@@ -1246,7 +1257,9 @@ function SignupForm(props: { config: AppConfig; shiftId: number; eventId: number
<p class="signup-note">Your full name is listed on the public sign-up page. Email, phone, and notes stay off that page.</p> <p class="signup-note">Your full name is listed on the public sign-up page. Email, phone, and notes stay off that page.</p>
</div> </div>
<noscript> <noscript>
<p class="error">Signing up needs JavaScript for the abuse check. The pantry has not published a contact method for help with signup.</p> <p class="error">
<PantryHelp lead="Signing up needs JavaScript. Call the pantry at" />
</p>
</noscript> </noscript>
{errorEntries.length > 0 ? ( {errorEntries.length > 0 ? (
<div class="error" role="alert"> <div class="error" role="alert">
@@ -1301,7 +1314,16 @@ function SignupForm(props: { config: AppConfig; shiftId: number; eventId: number
: undefined : undefined
} }
/> />
<Field id="signup-email" label="Email" name="email" type="email" value={form.values.email} error={errors.email} autoComplete="email" /> <Field
id="signup-email"
label="Email"
name="email"
type="email"
value={form.values.email}
error={errors.email}
autoComplete="email"
required
/>
<Field <Field
id="signup-phone" id="signup-phone"
label="Phone" label="Phone"
@@ -1327,7 +1349,9 @@ function SignupForm(props: { config: AppConfig; shiftId: number; eventId: number
<MoreDates dates={moreDates} eventId={props.eventId} selected={selected} count={extraCount} error={errors.dates} /> <MoreDates dates={moreDates} eventId={props.eventId} selected={selected} count={extraCount} error={errors.dates} />
) : null} ) : null}
<div class="cf-turnstile" data-sitekey={form.siteKey} data-action="signup" /> <div class="cf-turnstile" data-sitekey={form.siteKey} data-action="signup" />
<p class="signup-note" id="signup-turnstile-hint">This check confirms the signup came from a browser.</p> <p class="error" data-turnstile-fallback hidden={true}>
<PantryHelp lead="The signup check could not load. Call the pantry at" />
</p>
<button type="submit">{extraCount > 0 ? `Sign up for ${extraCount + 1} dates` : 'Sign up'}</button> <button type="submit">{extraCount > 0 ? `Sign up for ${extraCount + 1} dates` : 'Sign up'}</button>
</form> </form>
); );
+2
View File
@@ -141,6 +141,7 @@ export type ReminderPageSignup = {
eventTitle: string; eventTitle: string;
location: string; location: string;
when: ZonedClock; when: ZonedClock;
ends: ZonedClock;
groupSize: number; groupSize: number;
status: 'confirmed' | 'cancelled'; status: 'confirmed' | 'cancelled';
ended: boolean; ended: boolean;
@@ -188,6 +189,7 @@ export function readReminderSignup(db: Database.Database, signupId: number, now:
eventTitle: row.title, eventTitle: row.title,
location: row.location.trim(), location: row.location.trim(),
when: formatInstantInZone(row.starts_at_utc, row.tz), when: formatInstantInZone(row.starts_at_utc, row.tz),
ends: formatInstantInZone(row.ends_at_utc, row.tz),
groupSize: Number(row.group_size), groupSize: Number(row.group_size),
status: row.status, status: row.status,
ended: row.ends_at_utc <= now, ended: row.ends_at_utc <= now,
+1 -1
View File
@@ -53,7 +53,7 @@ const SWITCH_ORIGIN = 'The switch could not be sent from this page.';
const SWITCH_REJECTED = 'The switch could not be confirmed. Please try again.'; const SWITCH_REJECTED = 'The switch could not be confirmed. Please try again.';
const SWITCH_UNAVAILABLE = 'The switch could not be saved. Please try again in a little while.'; const SWITCH_UNAVAILABLE = 'The switch could not be saved. Please try again in a little while.';
const SWITCH_STALE = 'This form is out of date. Submit it again.'; const SWITCH_STALE = 'This form is out of date. Submit it again.';
const SWITCHED_NOTE = 'You are on this shift. This link replaces the earlier one. A change email is queued.'; const SWITCHED_NOTE = 'You are on this shift. This link replaces the earlier one. A change email is on the way.';
const PARTY_ORIGIN = 'The update could not be sent from this page.'; const PARTY_ORIGIN = 'The update could not be sent from this page.';
const PARTY_REJECTED = 'The update could not be confirmed. Please try again.'; const PARTY_REJECTED = 'The update could not be confirmed. Please try again.';
const PARTY_UNAVAILABLE = 'The update could not be saved. Please try again in a little while.'; const PARTY_UNAVAILABLE = 'The update could not be saved. Please try again in a little while.';
+2
View File
@@ -47,6 +47,7 @@ export type ManageView = {
location: string; location: string;
eventTitle: string; eventTitle: string;
when: ZonedClock; when: ZonedClock;
ends: ZonedClock;
/** True once the shift's end instant has been reached. The private link can no longer change this signup. */ /** True once the shift's end instant has been reached. The private link can no longer change this signup. */
ended: boolean; ended: boolean;
}; };
@@ -278,6 +279,7 @@ export function readManageSignup(db: Database.Database, token: string, now: stri
location: row.location, location: row.location,
eventTitle: row.title, eventTitle: row.title,
when: formatInstantInZone(row.starts_at_utc, row.tz), when: formatInstantInZone(row.starts_at_utc, row.tz),
ends: formatInstantInZone(row.ends_at_utc, row.tz),
ended: row.ends_at_utc <= now, ended: row.ends_at_utc <= now,
}; };
} }
+3
View File
@@ -526,6 +526,9 @@ describe('coordinator screens', () => {
expect(optionValues(html, 'destination')).toEqual([String(destinationId)]); expect(optionValues(html, 'destination')).toEqual([String(destinationId)]);
expect(html).toContain('<optgroup label="Friday, October 23, 2026">'); expect(html).toContain('<optgroup label="Friday, October 23, 2026">');
expect(html).toContain('>Distribution, October 23, 2026, 9:00 AM to 12:00 PM CDT<'); expect(html).toContain('>Distribution, October 23, 2026, 9:00 AM to 12:00 PM CDT<');
expect(html).toContain('href="mailto:kim@example.invalid"');
expect(html).toContain('href="tel:+17125550199"');
expect(html).toContain('>Move to another shift</summary>');
const moved = await postMove(app, cookie, signupId, html, String(destinationId)); const moved = await postMove(app, cookie, signupId, html, String(destinationId));
expect(moved.status).toBe(303); expect(moved.status).toBe(303);
expect(moved.headers.get('location')).toBe(`/admin/shifts/${destinationId}?notice=moved`); expect(moved.headers.get('location')).toBe(`/admin/shifts/${destinationId}?notice=moved`);
+5 -1
View File
@@ -36,7 +36,11 @@ describe('manage-link cancellation', () => {
}; };
const viewed = await app.request(managePath); const viewed = await app.request(managePath);
expect(viewed.status).toBe(200); expect(viewed.status).toBe(200);
expect(await viewed.text()).toContain('Cancel this signup'); const viewedHtml = await viewed.text();
expect(viewedHtml).toContain('Cancel this signup');
expect(viewedHtml).toContain('>Cancel<');
expect(viewedHtml).toContain('>9:00 AM</time> to <time dateTime="12:00">12:00 PM</time>');
expect(viewedHtml).not.toContain('queues a change email');
expect(db.prepare('SELECT status, updated_at FROM signups').get()).toEqual({ expect(db.prepare('SELECT status, updated_at FROM signups').get()).toEqual({
status: 'confirmed', status: 'confirmed',
updated_at: before.updated_at, updated_at: before.updated_at,
+13
View File
@@ -168,6 +168,17 @@ describe('public pages', () => {
expect(shiftHtml).toContain('name="last_name"'); expect(shiftHtml).toContain('name="last_name"');
expect(shiftHtml).toContain('First name'); expect(shiftHtml).toContain('First name');
expect(shiftHtml).toContain('Last name'); expect(shiftHtml).toContain('Last name');
expect(shiftHtml).toContain('9:00 AM to 12:00 PM');
expect(shiftHtml).toMatch(/id="signup-email"[^>]*required/);
expect(shiftHtml).toContain('Signing up needs JavaScript. Call the pantry at');
expect(shiftHtml).toContain('712\u2011540\u20119351');
expect(shiftHtml).toContain('href="tel:+17125409351"');
expect(shiftHtml).toContain('href="mailto:hopepantry@gmail.com"');
expect(shiftHtml).toContain('data-turnstile-fallback');
expect(shiftHtml).toContain('The signup check could not load.');
expect(shiftHtml).not.toContain('has not published a contact method');
expect(shiftHtml).not.toContain('abuse check');
expect(shiftHtml).not.toContain('This check confirms the signup came from a browser');
expect(shiftHtml).toContain('class="signup-note">Your full name is listed on the public sign-up page. Email, phone, and notes stay off that page.'); expect(shiftHtml).toContain('class="signup-note">Your full name is listed on the public sign-up page. Email, phone, and notes stay off that page.');
expect(shiftHtml).not.toContain('name="robots"'); expect(shiftHtml).not.toContain('name="robots"');
expect(shift.headers.get('x-robots-tag')).toBeNull(); expect(shift.headers.get('x-robots-tag')).toBeNull();
@@ -176,6 +187,8 @@ describe('public pages', () => {
expect(shiftHtml).not.toContain('data-guardian'); expect(shiftHtml).not.toContain('data-guardian');
expect(shiftHtml).not.toContain('I am under 18'); expect(shiftHtml).not.toContain('I am under 18');
const css = await (await app.request('/css/app.css')).text(); const css = await (await app.request('/css/app.css')).text();
expect(css).toContain('@media print');
expect(css).toContain('.roster-move');
expect(css).toContain('grid-template-columns: repeat(4, minmax(0, 1fr))'); expect(css).toContain('grid-template-columns: repeat(4, minmax(0, 1fr))');
expect(css).toContain('grid-template-columns: repeat(2, minmax(0, 1fr))'); expect(css).toContain('grid-template-columns: repeat(2, minmax(0, 1fr))');
expect(css).not.toContain('minmax(16rem, 1fr)'); expect(css).not.toContain('minmax(16rem, 1fr)');
+2
View File
@@ -273,6 +273,8 @@ describe('reminder mail', () => {
const confirmHtml = await confirm.text(); const confirmHtml = await confirm.text();
expect(confirmHtml).toContain('Are you sure you want to cancel?'); expect(confirmHtml).toContain('Are you sure you want to cancel?');
expect(confirmHtml).toContain('Cancel this signup to open the spot for someone else.'); expect(confirmHtml).toContain('Cancel this signup to open the spot for someone else.');
expect(confirmHtml).toContain('We&#39;ll email you when it&#39;s cancelled.');
expect(confirmHtml).toContain('>9:00 AM</time> to <time dateTime="12:00">12:00 PM</time>');
expect(confirmHtml).toContain('Pat Review'); expect(confirmHtml).toContain('Pat Review');
expect(confirmHtml).toContain('Sorting'); expect(confirmHtml).toContain('Sorting');
expect(db.prepare(`SELECT status FROM signups`).get()).toEqual({ status: 'confirmed' }); expect(db.prepare(`SELECT status FROM signups`).get()).toEqual({ status: 'confirmed' });