feat: give the app its own nav under the pantry header

Site links now follow hopefoodpantrysc.org. Calendar, Coordinator, and Log out sit in a separate white pill on every page.
This commit is contained in:
blake committed 2026-10-17 15:47:27 -05:00
1 parent ec259f58b2
commit 03da30dbbc
5 files changed
+660 -458

No files matched your search

+20 -14
View File
@@ -45,20 +45,28 @@ describe('public pages', () => {
expect(html).toContain('aria-current="date"');
expect(html).toContain('In progress');
expect(html).not.toContain('Volunteer tools');
const header = html.slice(html.indexOf('class="site-header"'), html.indexOf('<main'));
expect(header).toContain('Coordinator');
expect(header).toContain('>Privacy</a>');
expect(header).toContain('href="/" aria-current="page">Calendar</a>');
const header = html.slice(html.indexOf('class="header"'), html.indexOf('<main'));
expect(header).toContain('class="main-nav-link" href="/" aria-current="page">Volunteering</a>');
expect(header).not.toContain('href="/privacy" aria-current="page"');
expect(header).toContain('href="https://hopefoodpantrysc.org/"');
expect(header).toContain('href="https://hopefoodpantrysc.org/about"');
expect(header).toContain('href="https://hopefoodpantrysc.org/faq"');
expect(header).toContain('href="https://hopefoodpantrysc.org/#contact"');
expect(header).toContain('https://donorbox.org/hope-food-pantry-1');
expect(header).not.toContain('Coordinator');
expect(header).not.toContain('>Privacy</a>');
expect(header).not.toContain('Calendar');
expect(header).not.toContain('Log out');
const nav = html.slice(html.indexOf('class="nav-links"'), html.indexOf('</nav>'));
const nav = html.slice(html.indexOf('class="nav-links"'), html.indexOf('</ul>'));
expect(nav).toContain('Donate');
expect(nav).not.toContain('Coordinator');
expect(nav).not.toContain('Privacy');
expect(nav).not.toContain('Log out');
const footer = html.slice(html.indexOf('site-footer'));
expect(footer).toContain('Privacy');
const footer = html.slice(html.indexOf('class="footer"'));
expect(footer).toContain('equal opportunity provider');
expect(footer).toContain('Cosmically Creative');
expect(footer).toContain('712\u2011540\u20119351');
expect(footer).toContain('class="main-nav-link" href="/" aria-current="page">Volunteering</a>');
expect(footer).not.toContain('Privacy');
expect(footer).not.toContain('Coordinator');
expect(html).not.toContain('Cancelled Distribution');
expect(html).not.toContain('Past Setup');
@@ -99,7 +107,7 @@ describe('public pages', () => {
expect(shift.status).toBe(200);
expect(shiftHtml).toContain('Open Sorting');
expect(shiftHtml).not.toContain('class="crumb"');
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('site-footer'));
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('class="footer"'));
expect(shiftMain).not.toContain('Weekly pantry');
expect(shiftMain).not.toContain('sunburst');
expect(shiftHtml).toContain('1/3 spots filled');
@@ -144,7 +152,7 @@ describe('public pages', () => {
it('leaves the event name and sunburst off shift pages', async () => {
const { app, ids } = await buildApp();
const shiftHtml = await (await app.request(`/s/${ids.open}`)).text();
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('site-footer'));
const shiftMain = shiftHtml.slice(shiftHtml.indexOf('<main'), shiftHtml.indexOf('class="footer"'));
expect(shiftMain).toContain('Open Sorting');
expect(shiftMain).not.toContain('class="crumb"');
expect(shiftMain).not.toContain('Weekly pantry');
@@ -159,10 +167,8 @@ describe('public pages', () => {
const privacy = await app.request('/privacy');
const privacyHtml = await privacy.text();
expect(privacy.status).toBe(200);
expect(privacyHtml).toContain('href="/">Calendar</a>');
expect(privacyHtml).toContain('class="main-nav-link" href="/">Volunteering</a>');
expect(privacyHtml).not.toContain('href="/" aria-current="page"');
expect(privacyHtml).toContain('href="/privacy" aria-current="page">Privacy</a>');
expect(privacyHtml).not.toContain('aria-current="page"');
expect(privacyHtml).toContain('does not have an approved privacy notice yet');
expect(privacyHtml).toContain('This page is not a privacy policy.');
expect(privacyHtml).not.toContain('24 months');
@@ -196,7 +202,7 @@ describe('public pages', () => {
expect(html).toContain('Weekly pantry');
expect(html).not.toContain('Upcoming shifts');
expect((await app.request('/volunteer/e/weekly-pantry')).status).toBe(200);
expect(html).toContain('href="/volunteer/privacy"');
expect(html).toContain('class="main-nav-link" href="/volunteer" aria-current="page">Volunteering</a>');
expect(html).toMatch(/href="\/volunteer\/s\/\d+"/);
const slash = await app.request('/volunteer/');
expect(slash.status).toBe(302);