diff --git a/nextjs-app/__tests__/components/sectionShared.test.tsx b/nextjs-app/__tests__/components/sectionShared.test.tsx
new file mode 100644
index 0000000..e29da9f
--- /dev/null
+++ b/nextjs-app/__tests__/components/sectionShared.test.tsx
@@ -0,0 +1,24 @@
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { RowLabel } from '@/components/compare/sectionShared';
+
+describe('RowLabel', () => {
+ it('renders its label text', () => {
+ render(Attainment 8);
+ expect(screen.getByText('Attainment 8')).toBeInTheDocument();
+ });
+
+ it('shows no help affordance when no tip is given', () => {
+ render(Attainment 8);
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
+ });
+
+ it('opens the tip in a popover on click', async () => {
+ const user = userEvent.setup();
+ render(Attainment 8);
+ await user.click(screen.getByRole('button'));
+ expect(await screen.findByRole('tooltip')).toHaveTextContent(
+ 'Average GCSE score across 8 subjects',
+ );
+ });
+});
diff --git a/nextjs-app/components/compare/compareSections.module.css b/nextjs-app/components/compare/compareSections.module.css
index f3c5131..af7712f 100644
--- a/nextjs-app/components/compare/compareSections.module.css
+++ b/nextjs-app/components/compare/compareSections.module.css
@@ -132,20 +132,6 @@
color: var(--text-secondary);
}
-.help {
- display: inline-flex;
- width: 15px;
- height: 15px;
- border-radius: 50%;
- border: 1px solid var(--text-muted);
- color: var(--text-muted);
- font-size: 0.65rem;
- align-items: center;
- justify-content: center;
- cursor: help;
- flex: none;
-}
-
.badge {
display: inline-block;
font-weight: 700;
diff --git a/nextjs-app/components/compare/sectionShared.tsx b/nextjs-app/components/compare/sectionShared.tsx
index 0c27ea5..74211c9 100644
--- a/nextjs-app/components/compare/sectionShared.tsx
+++ b/nextjs-app/components/compare/sectionShared.tsx
@@ -11,6 +11,7 @@ import type { CSSProperties, ReactNode } from 'react';
import type { School } from '@/lib/types';
import { CHART_COLORS, CHART_TEXT_COLORS, shortName } from '@/lib/utils';
+import { InfoPopover } from '@/components/InfoPopover';
import styles from './compareSections.module.css';
export function Section({
@@ -52,11 +53,7 @@ export function RowLabel({ children, tip }: { children: ReactNode; tip?: string
return (
{children}
- {tip && (
-
- ?
-
- )}
+ {tip && }
);
}