Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/src/components/AidGuideSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CATEGORY_COLOR: Record<string, string> = {

const SANS = "'Outfit',sans-serif"

export type AidGuideDestination = 'fafsa' | 'deadlines' | 'scholarship-search'
export type AidGuideDestination = 'fafsa' | 'scholarships' | 'scholarship-search'

const Chevron = () => (
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M6 4l4 4-4 4"/></svg>
Expand Down Expand Up @@ -270,7 +270,7 @@ export default function AidGuideSections({ homeState, yourSchools, listFailed, o
{otherGrants.map(grantItem)}
</details>
) : otherGrants.map(grantItem)}
<EdvifiCan color={ROWS.state.color} can="line up the FAFSA priority date for every school on your list." cta="See my deadlines" onClick={() => onGoTo('deadlines')} />
<EdvifiCan color={ROWS.state.color} can="line up the FAFSA priority date for every school on your list." cta="See my schools’ dates" onClick={() => onGoTo('scholarships')} />
</Row>

<Row kind="types" title="Five kinds of scholarships" summary="Merit, need, institutional, national and specialized" open={open === 'types'} onToggle={() => toggle('types')}>
Expand Down
7 changes: 5 additions & 2 deletions web/src/components/ChecklistContentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface Props {
contentMap: Record<string, ChecklistContent>
allIds: string[]
accentColor: string
/** Where Back goes, as its label says it. */
backLabel?: string
onBack: () => void
onMarkComplete: (itemId: string) => void
onNavigate: (itemId: string) => void
Expand All @@ -36,6 +38,7 @@ export default function ChecklistContentView({
contentMap,
allIds,
accentColor,
backLabel = 'Back to Overview',
onBack,
onMarkComplete,
onNavigate,
Expand All @@ -51,7 +54,7 @@ export default function ChecklistContentView({
return (
<div style={{ padding: '28px 30px' }}>
<button onClick={onBack} style={{ fontFamily: "'Outfit',sans-serif", fontSize: 13, fontWeight: 500, color: C.textMuted, background: 'none', border: 'none', cursor: 'pointer', padding: 0, marginBottom: 16, display: 'flex', alignItems: 'center', gap: 5 }}>
← Back to Overview
← {backLabel}
</button>
<p style={{ fontFamily: "'Outfit',sans-serif", fontSize: 14, color: C.textMuted }}>Content not found for this item.</p>
</div>
Expand All @@ -64,7 +67,7 @@ export default function ChecklistContentView({
return (
<div style={{ padding: '24px 30px 32px' }}>
<button onClick={onBack} style={{ fontFamily: "'Outfit',sans-serif", fontSize: 13, fontWeight: 500, color: C.textMuted, background: 'none', border: 'none', cursor: 'pointer', padding: 0, marginBottom: 16, display: 'flex', alignItems: 'center', gap: 5 }}>
← Back to Overview
← {backLabel}
</button>

<div style={{ marginBottom: 20 }}>
Expand Down
34 changes: 13 additions & 21 deletions web/src/components/FafsaModuleTour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { MODULE_COLORS } from '../lib/designTokens'

export type TourTabId =
| 'overview'
| 'scholarships-101'
| 'scholarships'
| 'scholarship-search'
| 'deadlines'

interface Props {
onDismiss: () => void
Expand Down Expand Up @@ -56,10 +56,19 @@ const STEPS: TourStep<TourTabId>[] = [
keepClear: ['content'],
},

{
selector: '[data-tour="tab-scholarships-101"]',
pad: 6,
title: 'Scholarships 101',
desc: 'How scholarships work, where to find ones you qualify for, and how to apply, in six short steps.',
switchTab: 'scholarships-101',
keepClear: ['sidebar', 'content'],
},

{
selector: '[data-tour="tab-scholarship-search"]',
pad: 6,
title: 'Aid Engine',
title: 'Scholarship Engine',
// Points at the tab, not into it: on a first visit the tab is the
// preferences form, so its filters aren't there to point at yet.
desc: 'Answer a few questions and we score every scholarship for how well it fits you, with a few picked to start on. Track the ones worth applying to.',
Expand All @@ -70,29 +79,12 @@ const STEPS: TourStep<TourTabId>[] = [
{
selector: '[data-tour="tab-scholarships"]',
pad: 6,
title: 'My Scholarships',
desc: 'Every scholarship you track, with its deadline, its status and a checklist of what to send. Things like your transcript count once for all of them.',
title: 'Aid Tracker',
desc: 'When the FAFSA and CSS Profile are due at each of your schools, then every scholarship you track, with its deadline, its status and a checklist of what to send.',
switchTab: 'scholarships',
keepClear: ['sidebar', 'content'],
},

{
selector: '[data-tour="tab-deadlines"]',
pad: 6,
title: 'Deadlines',
desc: 'Track financial aid deadlines for your college list. Missing a priority deadline can cost thousands.',
switchTab: 'deadlines',
keepClear: ['sidebar', 'content'],
},
{
selector: '[data-tour="deadlines-search"]',
pad: 8,
title: 'Add Colleges',
desc: 'Search and add colleges to see their FAFSA, CSS Profile, and aid letter deadlines with urgency indicators.',
switchTab: 'deadlines',
keepClear: ['content'],
},

{
selector: '[data-tour="breadcrumb"]',
pad: 6,
Expand Down
91 changes: 91 additions & 0 deletions web/src/components/FinancialAidModule.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { describe, it, expect, vi } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { AidForms, Scholarships101Tab } from './FinancialAidModule'
import { ContentBlockRenderer } from './contentBlocks'
import type { AidCollege } from '../lib/aidColleges'

vi.mock('../lib/supabase', () => ({ supabase: {} }))

const school = (name: string, over: Partial<AidCollege> = {}): AidCollege => ({
id: name, canonicalId: name, name, emoji: '🎓', domain: null, type: '4-year', control: 'Private', isPublic: false,
city: null, state: null, npcUrl: null, costOfAttendance: null, costOutOfState: null,
applicationDeadlines: { earlyAction: null, earlyDecision: null, regularDecision: null },
financialAidDeadlines: { fafsaPriority: null, cssProfile: null, aidNotification: null },
meetsFullNeed: false, noLoanPolicy: false, curated: false, guarantee: null,
...over,
})
const state = (colleges: AidCollege[]) => ({ colleges, loading: false, failed: false, unresolved: [] })

describe('AidForms', () => {
const list = state([
school('Duke', { curated: true, financialAidDeadlines: { fafsaPriority: 'Feb 1, 2027', cssProfile: 'Nov 1, 2026', aidNotification: null } }),
school('UNC', { isPublic: true, control: 'Public', financialAidDeadlines: { fafsaPriority: 'Jan 15, 2027', cssProfile: null, aidNotification: null } }),
school('Elon'),
])

it('sums up the list and opens onto each school', async () => {
render(<AidForms aid={list} gradeStartIdx={null} />)
expect(screen.getByText(/^Your earliest school date: Jan 15, \d{4} \(UNC\)$/)).toBeInTheDocument()
expect(screen.getByText('Needed by 1 of your 3 schools; 1 more may need it')).toBeInTheDocument()

const css = screen.getByRole('button', { name: /CSS Profile/ })
expect(css).toHaveAttribute('aria-expanded', 'false')
await userEvent.click(css)
expect(css).toHaveAttribute('aria-expanded', 'true')
expect(screen.getByText(/^Nov 1, \d{4}$/)).toBeInTheDocument()
expect(screen.getByText('Check its aid page')).toBeInTheDocument()
expect(screen.getByText('Not usually')).toBeInTheDocument()
})

it('goes to Aid Tracker instead of opening on Overview', async () => {
const onSeeSchools = vi.fn()
render(<AidForms aid={list} gradeStartIdx={null} onSeeSchools={onSeeSchools} />)
const fafsa = screen.getByRole('button', { name: /FAFSA/ })
expect(fafsa).not.toHaveAttribute('aria-expanded')
await userEvent.click(fafsa)
expect(onSeeSchools).toHaveBeenCalledOnce()
expect(screen.queryByText('No date on file')).not.toBeInTheDocument()
})

it('points an empty list at Application Tracking', async () => {
render(<AidForms aid={state([])} gradeStartIdx={null} />)
expect(screen.getAllByText('Add schools in Application Tracking to see what each one asks for')).toHaveLength(2)
await userEvent.click(screen.getByRole('button', { name: /FAFSA/ }))
expect(screen.getByRole('link', { name: 'Application Tracking' })).toHaveAttribute('href', '#/dashboard/application-tracking/discover')
})
})

describe('Scholarships 101', () => {
it('lists the six steps in order and opens each one', async () => {
const onToggle = vi.fn()
render(<Scholarships101Tab progress={{ 'sr-1': 'completed' }} onToggle={onToggle} />)
expect(screen.getByText('1/6 completed')).toBeInTheDocument()
await userEvent.click(screen.getByText('Understanding scholarships: types, eligibility, and how they work'))
expect(onToggle).toHaveBeenCalledWith('sr-5')
expect(screen.getByText('1 of 6')).toBeInTheDocument()
expect(screen.getByRole('heading', { name: 'What Is a Scholarship?' })).toBeInTheDocument()
expect(screen.getByRole('button', { name: /Back to Scholarships 101/ })).toBeInTheDocument()
// Last step's article is there too, and the "next" button stops at it.
await userEvent.click(screen.getByRole('button', { name: /Back to Scholarships 101/ }))
await userEvent.click(screen.getByText('Identify 10 scholarships to apply to senior year'))
expect(screen.getByText('6 of 6')).toBeInTheDocument()
expect(screen.queryByText('Content not found for this item.')).not.toBeInTheDocument()
})
})

describe('content blocks', () => {
it('renders bold, italic, numbered lists and tables', () => {
const { container } = render(<>
<ContentBlockRenderer accentColor="#000" block={{ kind: 'paragraph', text: 'Pay **how often** you *can* get it, 3 * 2' }} />
<ContentBlockRenderer accentColor="#000" block={{ kind: 'list', ordered: true, items: ['First', 'Second'] }} />
<ContentBlockRenderer accentColor="#000" block={{ kind: 'table', head: ['Factor', 'Ask'], rows: [['Eligibility', 'Do I **qualify**?']] }} />
</>)
expect(container.querySelector('strong')?.textContent).toBe('how often')
expect(container.querySelector('em')?.textContent).toBe('can')
expect(screen.getByText(/, 3 \* 2$/)).toBeInTheDocument()
expect(container.querySelector('ol')?.textContent).toBe('1.First2.Second')
expect(screen.getByRole('columnheader', { name: 'Factor' })).toBeInTheDocument()
expect(container.querySelectorAll('td')[1].innerHTML).toBe('Do I <strong style="font-weight: 700;">qualify</strong>?')
})
})
Loading
Loading