Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a link to the FSH Online Examples repo #142

Merged
merged 4 commits into from
Sep 20, 2023
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
28 changes: 21 additions & 7 deletions src/components/FSHControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
FormControlLabel,
FormHelperText,
Grid,
Link,
MenuItem,
Tooltip,
TextField
Expand Down Expand Up @@ -89,6 +90,13 @@ const useStyles = makeStyles((theme) => ({
dialogPaper: {
maxHeight: '80vh',
minHeight: '80vh'
},
dialogActions: {
justifyContent: 'space-between'
},
dialogActionsMessage: {
fontStyle: 'italic',
padding: '6px 8px'
}
}));

Expand Down Expand Up @@ -423,13 +431,19 @@ export default function FSHControls(props) {
</Grid>
</Grid>
</DialogContent>
<DialogActions>
<Button onClick={handleCopyToClipboard} color="primary">
<AssignmentOutlinedIcon></AssignmentOutlinedIcon> Copy to clipboard
</Button>
<Button onClick={handleCloseExamples} color="secondary">
Close
</Button>
<DialogActions className={classes.dialogActions}>
<div className={classes.dialogActionsMessage}>
Have an example that might be bene-fish-al? Seas the day and add to our collection on{' '}
<Link href="https://github.com/FSHSchool/FSHOnline-Examples#readme">GitHub</Link>!
</div>
<div>
<Button onClick={handleCopyToClipboard} color="primary">
<AssignmentOutlinedIcon></AssignmentOutlinedIcon> Copy to clipboard
</Button>
<Button onClick={handleCloseExamples} color="secondary">
Close
</Button>
</div>
</DialogActions>
</Dialog>
</Box>
Expand Down
14 changes: 14 additions & 0 deletions src/tests/components/FSHControls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,20 @@ it('should properly render the examples in the file tree', async () => {
expect(manifestChild2).toBeInTheDocument();
});

it('should include a link to the examples repo', () => {
const { getByRole, getByText } = render(<FSHControls exampleConfig={[]} />, container);

const examplesButton = getByRole('button', { name: /Examples/i });
expect(examplesButton).toBeInTheDocument();
fireEvent.click(examplesButton);

const exampleRepoText = getByText(/Have an example that might be bene-fish-al?/);
expect(exampleRepoText).toBeInTheDocument();
const exampleRepoUrl = getByRole('link');
expect(exampleRepoUrl).toBeInTheDocument();
expect(exampleRepoUrl).toHaveAttribute('href', 'https://github.com/FSHSchool/FSHOnline-Examples#readme');
});

it.skip('should populate editor when examples are collected', async () => {
const updateTextValueSpy = jest.fn();

Expand Down
Loading