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
7 changes: 6 additions & 1 deletion app/src/components/PlotOfTheDay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const mockData = {
description: 'A scatter plot',
library_id: 'matplotlib',
library_name: 'Matplotlib',
language: 'python',
quality_score: 9,
preview_url: 'https://cdn.example.com/plots/scatter-basic/matplotlib/plot.png',
image_description: 'Shows data points with clear labels',
Expand Down Expand Up @@ -175,7 +176,11 @@ describe('PlotOfTheDay', () => {
await user.click(screen.getByText('Basic Scatter Plot'));
expect(trackEvent).toHaveBeenCalledWith('nav_click', expect.objectContaining({ source: 'potd_title' }));

await user.click(screen.getByText(/python plots\/scatter-basic\/matplotlib\.py/));
const sourceLink = screen.getByText(/python plots\/scatter-basic\/matplotlib\.py/);
expect(sourceLink.getAttribute('href')).toMatch(
/\/blob\/main\/plots\/scatter-basic\/implementations\/python\/matplotlib\.py$/,
);
await user.click(sourceLink);
expect(trackEvent).toHaveBeenCalledWith('nav_click', expect.objectContaining({ source: 'potd_source_link' }));
});

Expand Down
2 changes: 1 addition & 1 deletion app/src/components/PlotOfTheDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function PlotOfTheDay() {
<Typography sx={{ fontFamily: mono, fontSize: fontSize.xs, color: colors.primary, fontWeight: 600 }}>$</Typography>
<Typography
component="a"
href={`${GITHUB_URL}/blob/main/plots/${data.spec_id}/implementations/${data.library_id}.py`}
href={`${GITHUB_URL}/blob/main/plots/${data.spec_id}/implementations/${data.language}/${data.library_id}.py`}
target="_blank"
rel="noopener noreferrer"
onClick={(e: React.MouseEvent) => {
Expand Down
6 changes: 5 additions & 1 deletion app/src/components/PlotOfTheDayTerminal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ describe('PlotOfTheDayTerminal', () => {
await user.click(screen.getByText(/plots\/scatter-basic\/matplotlib\.py/));
expect(trackEvent).toHaveBeenCalledWith('nav_click', expect.objectContaining({ source: 'potd_terminal_filename' }));

await user.click(screen.getByLabelText('Open source on GitHub'));
const githubLink = screen.getByLabelText('Open source on GitHub');
expect(githubLink.getAttribute('href')).toMatch(
/\/blob\/main\/plots\/scatter-basic\/implementations\/python\/matplotlib\.py$/,
);
await user.click(githubLink);
expect(trackEvent).toHaveBeenCalledWith('nav_click', expect.objectContaining({ source: 'potd_terminal_github' }));

await user.click(screen.getByLabelText(/Open Basic Scatter implementation/));
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/PlotOfTheDayTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function PlotOfTheDayTerminal({

const displayFilename = `plots/${potd.spec_id}/${potd.library_id}.py`;
const implPath = specPath(potd.spec_id, potd.language, potd.library_id);
const githubFileUrl = `${GITHUB_URL}/blob/main/plots/${potd.spec_id}/implementations/${potd.library_id}.py`;
const githubFileUrl = `${GITHUB_URL}/blob/main/plots/${potd.spec_id}/implementations/${potd.language}/${potd.library_id}.py`;

return (
<Box
Expand Down
Loading