feat: implement signup dialog for event registration
Added a new signup dialog component that opens when users click on signup links. The dialog fetches and displays the signup form dynamically, enhancing user experience. Updated styles for the dialog and integrated it into the public schedule page. Adjusted asset loading rules to accommodate the new functionality.
This commit is contained in:
1 parent
df3165f6a8
commit
1f451dc830
5 files changed
+401
-8
No files matched your search
+99
-4
@@ -313,10 +313,10 @@ a.btn:active {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 28px;
|
gap: 28px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 4px 30px;
|
padding: 0;
|
||||||
background: #fff;
|
background: transparent;
|
||||||
border: 1px solid var(--hope-border-2);
|
border: 0;
|
||||||
border-radius: 50px;
|
border-radius: 0;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@@ -1597,6 +1597,101 @@ article.shift-card {
|
|||||||
height: 1.15rem;
|
height: 1.15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html:has(#signup-dialog[open]) {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#signup-dialog {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-card {
|
||||||
|
width: min(36rem, 100%);
|
||||||
|
max-height: calc(100dvh - 2rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.85rem;
|
||||||
|
right: 0.85rem;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#signup-dialog-body {
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 1.75rem;
|
||||||
|
max-height: inherit;
|
||||||
|
/* Keep the scrollbar off the curved corners. */
|
||||||
|
padding: 1.35rem 0.55rem 1.35rem 0;
|
||||||
|
background: var(--hope-blue-100);
|
||||||
|
box-shadow: var(--hope-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-panel {
|
||||||
|
display: grid;
|
||||||
|
width: 100%;
|
||||||
|
max-height: calc(100dvh - 2rem - 2.7rem);
|
||||||
|
overflow: auto;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
background: transparent;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: rgb(34 34 34 / 0.45) transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-panel::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-panel::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-panel::-webkit-scrollbar-thumb {
|
||||||
|
background: rgb(34 34 34 / 0.35);
|
||||||
|
border: 2px solid var(--hope-blue-100);
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-summary {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.15rem;
|
||||||
|
padding: 0 3.4rem 0.15rem 1.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-summary .location,
|
||||||
|
.signup-dialog-summary .when,
|
||||||
|
.signup-dialog-summary .status,
|
||||||
|
.signup-dialog-summary .spots {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signup-dialog-note {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.35rem 1.35rem 1.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-dialog .signup-dialog-panel .signup-form {
|
||||||
|
max-width: none;
|
||||||
|
max-height: none;
|
||||||
|
margin: 0;
|
||||||
|
overflow: visible;
|
||||||
|
background: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-dialog .signup-dialog-panel .signup-form h2 {
|
||||||
|
padding-right: 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.confirm-dialog {
|
.confirm-dialog {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
|
|||||||
@@ -0,0 +1,275 @@
|
|||||||
|
(function () {
|
||||||
|
var dialog = document.getElementById('signup-dialog');
|
||||||
|
var body = document.getElementById('signup-dialog-body');
|
||||||
|
if (!dialog || !body || typeof dialog.showModal !== 'function') return;
|
||||||
|
|
||||||
|
var requestId = 0;
|
||||||
|
var widgetId = null;
|
||||||
|
var turnstileLoading = null;
|
||||||
|
var lastTrigger = null;
|
||||||
|
|
||||||
|
document.querySelectorAll('a[data-signup]').forEach(function (link) {
|
||||||
|
link.setAttribute('aria-haspopup', 'dialog');
|
||||||
|
link.setAttribute('aria-controls', 'signup-dialog');
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', function (event) {
|
||||||
|
var link = event.target && event.target.closest ? event.target.closest('a[data-signup]') : null;
|
||||||
|
if (!link) return;
|
||||||
|
if (event.defaultPrevented || event.button !== 0) return;
|
||||||
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||||
|
var href = link.getAttribute('href');
|
||||||
|
if (!href) return;
|
||||||
|
event.preventDefault();
|
||||||
|
openSignup(link, href);
|
||||||
|
});
|
||||||
|
|
||||||
|
var closeButton = dialog.querySelector('[data-signup-close]');
|
||||||
|
if (closeButton) closeButton.addEventListener('click', function () { dialog.close(); });
|
||||||
|
|
||||||
|
dialog.addEventListener('click', function (event) {
|
||||||
|
if (event.target === dialog) dialog.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.addEventListener('close', function () {
|
||||||
|
requestId += 1;
|
||||||
|
clearWidget();
|
||||||
|
dialog.classList.remove('is-modal');
|
||||||
|
dialog.removeAttribute('aria-busy');
|
||||||
|
if (lastTrigger && typeof lastTrigger.focus === 'function') lastTrigger.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
function openSignup(link, href) {
|
||||||
|
lastTrigger = link;
|
||||||
|
var id = ++requestId;
|
||||||
|
showLoading();
|
||||||
|
if (!dialog.open) {
|
||||||
|
dialog.showModal();
|
||||||
|
dialog.classList.add('is-modal');
|
||||||
|
}
|
||||||
|
fetch(href, { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'text/html' } })
|
||||||
|
.then(function (response) {
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(function (html) {
|
||||||
|
if (id !== requestId) return;
|
||||||
|
fill(html, href);
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
if (id !== requestId) return;
|
||||||
|
showFailure(href);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLoading() {
|
||||||
|
clearWidget();
|
||||||
|
dialog.setAttribute('aria-busy', 'true');
|
||||||
|
var panel = panelWithTitle('Sign up');
|
||||||
|
var note = document.createElement('p');
|
||||||
|
note.className = 'signup-dialog-note';
|
||||||
|
note.setAttribute('role', 'status');
|
||||||
|
note.textContent = 'Loading the signup form.';
|
||||||
|
panel.appendChild(note);
|
||||||
|
body.replaceChildren(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFailure(href) {
|
||||||
|
clearWidget();
|
||||||
|
dialog.removeAttribute('aria-busy');
|
||||||
|
var panel = panelWithTitle('Sign up');
|
||||||
|
var note = document.createElement('p');
|
||||||
|
note.className = 'signup-dialog-note';
|
||||||
|
note.textContent = 'The signup form could not be loaded. ';
|
||||||
|
var link = document.createElement('a');
|
||||||
|
link.href = href;
|
||||||
|
link.textContent = 'Open the shift page';
|
||||||
|
note.appendChild(link);
|
||||||
|
panel.appendChild(note);
|
||||||
|
body.replaceChildren(panel);
|
||||||
|
if (closeButton) closeButton.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function fill(html, href) {
|
||||||
|
var doc = new DOMParser().parseFromString(html, 'text/html');
|
||||||
|
var main = doc.querySelector('main');
|
||||||
|
if (!main) {
|
||||||
|
showFailure(href);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var form = main.querySelector('form.signup-form');
|
||||||
|
var heading = main.querySelector('h1');
|
||||||
|
clearWidget();
|
||||||
|
dialog.removeAttribute('aria-busy');
|
||||||
|
var panel = document.createElement('div');
|
||||||
|
panel.className = 'signup-dialog-panel';
|
||||||
|
var summary = document.createElement('div');
|
||||||
|
summary.className = 'signup-dialog-summary';
|
||||||
|
var title = document.createElement('h2');
|
||||||
|
title.id = 'signup-dialog-label';
|
||||||
|
title.className = 'signup-dialog-title';
|
||||||
|
title.textContent = heading && heading.textContent ? heading.textContent.trim() : 'Sign up';
|
||||||
|
summary.appendChild(title);
|
||||||
|
appendFrom(summary, main, 'p.location');
|
||||||
|
appendFrom(summary, main, 'p.when');
|
||||||
|
appendFrom(summary, main, 'p.status');
|
||||||
|
appendFrom(summary, main, 'p.spots');
|
||||||
|
var notice = main.querySelector('p.error');
|
||||||
|
if (notice && (!form || !form.contains(notice))) summary.appendChild(document.importNode(notice, true));
|
||||||
|
panel.appendChild(summary);
|
||||||
|
if (!form) {
|
||||||
|
var closed = document.createElement('p');
|
||||||
|
closed.className = 'signup-dialog-note';
|
||||||
|
var paragraph = main.querySelector('p');
|
||||||
|
if (!main.querySelector('p.when') && paragraph) {
|
||||||
|
closed.textContent = paragraph.textContent.trim();
|
||||||
|
} else {
|
||||||
|
closed.textContent = 'This shift is not open for signup.';
|
||||||
|
}
|
||||||
|
panel.appendChild(closed);
|
||||||
|
body.replaceChildren(panel);
|
||||||
|
if (closeButton) closeButton.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var liveForm = document.importNode(form, true);
|
||||||
|
liveForm.querySelectorAll('noscript').forEach(function (node) { node.remove(); });
|
||||||
|
panel.appendChild(liveForm);
|
||||||
|
body.replaceChildren(panel);
|
||||||
|
bindForm(liveForm);
|
||||||
|
mountTurnstile(liveForm);
|
||||||
|
var field = firstField(liveForm);
|
||||||
|
if (field) field.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindForm(form) {
|
||||||
|
form.addEventListener('submit', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (form.getAttribute('data-sending') === 'true') return;
|
||||||
|
var action = form.getAttribute('action');
|
||||||
|
if (!action) return;
|
||||||
|
form.setAttribute('data-sending', 'true');
|
||||||
|
var submit = form.querySelector('button[type="submit"]');
|
||||||
|
if (submit) {
|
||||||
|
submit.disabled = true;
|
||||||
|
submit.textContent = 'Signing up…';
|
||||||
|
}
|
||||||
|
var id = requestId;
|
||||||
|
fetch(action, {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams(new FormData(form)),
|
||||||
|
credentials: 'same-origin',
|
||||||
|
cache: 'no-store',
|
||||||
|
headers: { Accept: 'text/html' },
|
||||||
|
})
|
||||||
|
.then(function (response) {
|
||||||
|
if (isConfirmed(response)) {
|
||||||
|
window.location.assign(response.url);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return response.text();
|
||||||
|
})
|
||||||
|
.then(function (html) {
|
||||||
|
if (html === null || id !== requestId) return;
|
||||||
|
fill(html, action);
|
||||||
|
})
|
||||||
|
.catch(function () {
|
||||||
|
if (id !== requestId || !form.isConnected) return;
|
||||||
|
form.removeAttribute('data-sending');
|
||||||
|
if (submit) {
|
||||||
|
submit.disabled = false;
|
||||||
|
submit.textContent = 'Sign up';
|
||||||
|
}
|
||||||
|
var alert = form.querySelector('[data-signup-send-error]');
|
||||||
|
if (!alert) {
|
||||||
|
alert = document.createElement('p');
|
||||||
|
alert.className = 'error';
|
||||||
|
alert.setAttribute('role', 'alert');
|
||||||
|
alert.setAttribute('data-signup-send-error', '');
|
||||||
|
form.insertBefore(alert, form.firstChild);
|
||||||
|
}
|
||||||
|
alert.textContent = 'The signup could not be sent. Please try again.';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function mountTurnstile(scope) {
|
||||||
|
var widget = scope.querySelector('.cf-turnstile');
|
||||||
|
var sitekey = widget && widget.getAttribute('data-sitekey');
|
||||||
|
if (!widget || !sitekey) return;
|
||||||
|
loadTurnstile()
|
||||||
|
.then(function () {
|
||||||
|
if (!widget.isConnected || !window.turnstile) return;
|
||||||
|
// turnstile.ready() throws when this script is inserted dynamically.
|
||||||
|
widgetId = window.turnstile.render(widget, {
|
||||||
|
sitekey: sitekey,
|
||||||
|
action: widget.getAttribute('data-action') || 'signup',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function () {});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadTurnstile() {
|
||||||
|
if (window.turnstile) return Promise.resolve();
|
||||||
|
if (turnstileLoading) return turnstileLoading;
|
||||||
|
turnstileLoading = new Promise(function (resolve, reject) {
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.src = 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit';
|
||||||
|
script.onload = function () { resolve(); };
|
||||||
|
script.onerror = function () {
|
||||||
|
turnstileLoading = null;
|
||||||
|
reject(new Error('Turnstile did not load.'));
|
||||||
|
};
|
||||||
|
document.head.appendChild(script);
|
||||||
|
});
|
||||||
|
return turnstileLoading;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearWidget() {
|
||||||
|
if (widgetId !== null && window.turnstile && window.turnstile.remove) {
|
||||||
|
try {
|
||||||
|
window.turnstile.remove(widgetId);
|
||||||
|
} catch (err) {
|
||||||
|
// The widget node is already gone.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
widgetId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function panelWithTitle(text) {
|
||||||
|
var panel = document.createElement('div');
|
||||||
|
panel.className = 'signup-dialog-panel';
|
||||||
|
var summary = document.createElement('div');
|
||||||
|
summary.className = 'signup-dialog-summary';
|
||||||
|
var title = document.createElement('h2');
|
||||||
|
title.id = 'signup-dialog-label';
|
||||||
|
title.className = 'signup-dialog-title';
|
||||||
|
title.textContent = text;
|
||||||
|
summary.appendChild(title);
|
||||||
|
panel.appendChild(summary);
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendFrom(parent, root, selector) {
|
||||||
|
var node = root.querySelector(selector);
|
||||||
|
if (node) parent.appendChild(document.importNode(node, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
function firstField(form) {
|
||||||
|
var invalid = form.querySelector('[aria-invalid="true"]');
|
||||||
|
if (invalid && typeof invalid.focus === 'function') return invalid;
|
||||||
|
var inputs = form.querySelectorAll('input, textarea, select');
|
||||||
|
for (var i = 0; i < inputs.length; i += 1) {
|
||||||
|
var input = inputs[i];
|
||||||
|
if (input.type === 'hidden' || input.tabIndex < 0) continue;
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isConfirmed(response) {
|
||||||
|
try {
|
||||||
|
return /\/confirmed\/?$/.test(new URL(response.url, window.location.href).pathname);
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
+19
-2
@@ -543,10 +543,27 @@ function PublicSchedule(props: {
|
|||||||
) : (
|
) : (
|
||||||
<WednesdayBoard config={props.config} event={props.event} now={props.now} />
|
<WednesdayBoard config={props.config} event={props.event} now={props.now} />
|
||||||
)}
|
)}
|
||||||
|
<SignupDialog config={props.config} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SignupDialog(props: { config: AppConfig }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<dialog id="signup-dialog" class="event-dialog" aria-labelledby="signup-dialog-label">
|
||||||
|
<div class="event-dialog-card signup-dialog-card">
|
||||||
|
<button type="button" class="event-dialog-close signup-dialog-close" data-signup-close aria-label="Close">
|
||||||
|
<img src={asset(props.config, '/img/icons/close.svg')} alt="" />
|
||||||
|
</button>
|
||||||
|
<div id="signup-dialog-body"></div>
|
||||||
|
</div>
|
||||||
|
</dialog>
|
||||||
|
<script src={asset(props.config, '/js/signup-dialog.js')} defer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
type WednesdayGroup = {
|
type WednesdayGroup = {
|
||||||
date: string;
|
date: string;
|
||||||
heading: string;
|
heading: string;
|
||||||
@@ -622,7 +639,7 @@ function ShiftPane(props: { config: AppConfig; shift: PublicShift }) {
|
|||||||
<span>Not accepting more signups</span>
|
<span>Not accepting more signups</span>
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<a class="btn-card" href={appPath(props.config, `/s/${shift.id}`)}>
|
<a class="btn-card" href={appPath(props.config, `/s/${shift.id}`)} data-signup={closed ? undefined : ''}>
|
||||||
{action}
|
{action}
|
||||||
<img src={asset(props.config, '/img/icons/right-arrow.svg')} alt="" />
|
<img src={asset(props.config, '/img/icons/right-arrow.svg')} alt="" />
|
||||||
</a>
|
</a>
|
||||||
@@ -794,7 +811,7 @@ function CalendarShift(props: { config: AppConfig; shift: PublicShift }) {
|
|||||||
const closed = shift.full || shift.cancelled || shift.ended;
|
const closed = shift.full || shift.cancelled || shift.ended;
|
||||||
const action = closed ? 'View shift' : 'Sign up';
|
const action = closed ? 'View shift' : 'Sign up';
|
||||||
return (
|
return (
|
||||||
<a class="cal-shift" href={appPath(props.config, `/s/${shift.id}`)}>
|
<a class="cal-shift" href={appPath(props.config, `/s/${shift.id}`)} data-signup={closed ? undefined : ''}>
|
||||||
<span class="cal-line">
|
<span class="cal-line">
|
||||||
{shift.when.startLabel} {shift.role}
|
{shift.when.startLabel} {shift.role}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ASSET_ROOTS = ['css', 'brand', 'img', 'js'];
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Same-origin GET links are fetched on hover.
|
* Same-origin GET links are fetched on hover.
|
||||||
* Confirm and new-event controls open a dialog instead of navigating.
|
* Confirm, new-event, and signup controls open a dialog instead of navigating.
|
||||||
* Cross-origin links are not eligible unless a rule asks for them.
|
* Cross-origin links are not eligible unless a rule asks for them.
|
||||||
*/
|
*/
|
||||||
export const SPECULATION_RULES = {
|
export const SPECULATION_RULES = {
|
||||||
@@ -25,7 +25,7 @@ export const SPECULATION_RULES = {
|
|||||||
where: {
|
where: {
|
||||||
and: [
|
and: [
|
||||||
{ href_matches: '/*' },
|
{ href_matches: '/*' },
|
||||||
{ not: { selector_matches: '[data-confirm], [data-open-event]' } },
|
{ not: { selector_matches: '[data-confirm], [data-open-event], [data-signup]' } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
eagerness: 'moderate',
|
eagerness: 'moderate',
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ describe('public pages', () => {
|
|||||||
expect(html).not.toContain('<form');
|
expect(html).not.toContain('<form');
|
||||||
expect(html).toContain('src="/js/desk.js?v=');
|
expect(html).toContain('src="/js/desk.js?v=');
|
||||||
expect(html).toContain('src="/js/enhance.js?v=');
|
expect(html).toContain('src="/js/enhance.js?v=');
|
||||||
|
expect(html).toContain('src="/js/signup-dialog.js?v=');
|
||||||
|
expect(html).toContain('id="signup-dialog"');
|
||||||
|
expect(html).toContain('data-signup');
|
||||||
expect(html).not.toContain('<script>alert(1)</script>');
|
expect(html).not.toContain('<script>alert(1)</script>');
|
||||||
expect(html).toContain('href="/css/app.css?v=');
|
expect(html).toContain('href="/css/app.css?v=');
|
||||||
expect(html).toContain('href="/brand/tokens.css?v=');
|
expect(html).toContain('href="/brand/tokens.css?v=');
|
||||||
@@ -130,6 +133,7 @@ describe('public pages', () => {
|
|||||||
expect(calendar).toContain('Lane Wednesday');
|
expect(calendar).toContain('Lane Wednesday');
|
||||||
expect(calendar).toContain('View shift');
|
expect(calendar).toContain('View shift');
|
||||||
expect(calendar).toContain(`href="/s/${ids.open}"`);
|
expect(calendar).toContain(`href="/s/${ids.open}"`);
|
||||||
|
expect(calendar).toContain('data-signup=""');
|
||||||
expect(calendar).not.toContain('secret.person@example.invalid');
|
expect(calendar).not.toContain('secret.person@example.invalid');
|
||||||
expect(calendar).not.toContain('SECRET-PERSON-NOTE');
|
expect(calendar).not.toContain('SECRET-PERSON-NOTE');
|
||||||
expect(calendar).not.toContain('November 2026');
|
expect(calendar).not.toContain('November 2026');
|
||||||
@@ -261,6 +265,7 @@ describe('public pages', () => {
|
|||||||
expect(body.prefetch[0].eagerness).toBe('moderate');
|
expect(body.prefetch[0].eagerness).toBe('moderate');
|
||||||
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-confirm]');
|
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-confirm]');
|
||||||
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-open-event]');
|
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-open-event]');
|
||||||
|
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-signup]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prefixes routes and assets when the app is mounted at /volunteer', async () => {
|
it('prefixes routes and assets when the app is mounted at /volunteer', async () => {
|
||||||
@@ -452,6 +457,7 @@ describe('public pages', () => {
|
|||||||
const openPane = html.slice(html.lastIndexOf('<section class="shift-pane"', openStart), html.indexOf('</section>', openStart));
|
const openPane = html.slice(html.lastIndexOf('<section class="shift-pane"', openStart), html.indexOf('</section>', openStart));
|
||||||
expect(openPane).toContain('>Sign up');
|
expect(openPane).toContain('>Sign up');
|
||||||
expect(openPane).toContain('href="/s/');
|
expect(openPane).toContain('href="/s/');
|
||||||
|
expect(openPane).toContain('data-signup=""');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows an empty list when nothing is upcoming', async () => {
|
it('shows an empty list when nothing is upcoming', async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user