Skip to content

Commit a19ae27

Browse files
authored
Merge branch 'develop' into feat/privatesketch
2 parents 205b238 + 40b1b0b commit a19ae27

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"tsx": "never"
3030
}
3131
],
32+
"react/jsx-filename-extension": [1, { "extensions": [".jsx", ".tsx"] }],
3233
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
3334
"default-param-last": 0,
3435
"no-else-return" :0,
@@ -126,7 +127,12 @@
126127
{
127128
"files": ["*.ts", "*.tsx"],
128129
"parser": "@typescript-eslint/parser",
129-
"plugins": ["@typescript-eslint"]
130+
"plugins": ["@typescript-eslint"],
131+
"rules": {
132+
"no-use-before-define": "off",
133+
"import/no-extraneous-dependencies": "off",
134+
"no-unused-vars": "off"
135+
}
130136
},
131137
{
132138
"files": ["*.stories.@(js|jsx|ts|tsx)"],

client/components/SkipLink.test.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { render, screen, fireEvent } from '@testing-library/react';
2+
import React from 'react';
3+
import { useTranslation } from 'react-i18next';
4+
import '@testing-library/jest-dom';
5+
import SkipLink from './SkipLink';
6+
7+
jest.mock('react-i18next', () => ({
8+
useTranslation: () => ({
9+
t: (key: string) => key
10+
})
11+
}));
12+
13+
describe('SkipLink', () => {
14+
const defaultProps = {
15+
targetId: 'main-content',
16+
text: 'goToMain'
17+
};
18+
19+
test('renders with correct href and text', () => {
20+
render(<SkipLink {...defaultProps} />);
21+
const link = screen.getByRole('link');
22+
23+
expect(link).toBeInTheDocument();
24+
expect(link).toHaveAttribute('href', '#main-content');
25+
expect(link).toHaveTextContent('SkipLink.goToMain');
26+
});
27+
28+
test('adds "focus" class on focus and removes it on blur', () => {
29+
render(<SkipLink {...defaultProps} />);
30+
const link = screen.getByRole('link');
31+
32+
expect(link.className).toBe('skip_link');
33+
34+
fireEvent.focus(link);
35+
expect(link.className).toContain('focus');
36+
37+
fireEvent.blur(link);
38+
expect(link.className).toBe('skip_link');
39+
});
40+
});

client/components/SkipLink.jsx renamed to client/components/SkipLink.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import React, { useState } from 'react';
22
import classNames from 'classnames';
3-
import PropTypes from 'prop-types';
43
import { useTranslation } from 'react-i18next';
54

6-
const SkipLink = ({ targetId, text }) => {
5+
type SkipLinkProps = {
6+
targetId: string,
7+
text: string
8+
};
9+
10+
const SkipLink = ({ targetId, text }: SkipLinkProps) => {
711
const [focus, setFocus] = useState(false);
812
const { t } = useTranslation();
913
const handleFocus = () => {
@@ -27,9 +31,4 @@ const SkipLink = ({ targetId, text }) => {
2731
);
2832
};
2933

30-
SkipLink.propTypes = {
31-
targetId: PropTypes.string.isRequired,
32-
text: PropTypes.string.isRequired
33-
};
34-
3534
export default SkipLink;

common/p5Versions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ export const currentP5Version = '1.11.8'; // Don't update to 2.x until 2026
55
// JSON.stringify([...document.querySelectorAll('._132722c7')].map(n => n.innerText), null, 2)
66
// TODO: use their API for this to grab these at build time?
77
export const p5Versions = [
8+
'2.0.4',
89
'2.0.3',
910
'2.0.2',
1011
'2.0.1',
1112
'2.0.0',
13+
'1.11.9',
1214
'1.11.8',
1315
'1.11.7',
1416
'1.11.6',

contributor_docs/preparing_a_pull_request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Pull-requests are easier when your code is up to date!
88
Before submitting a pull request, make sure that:
99

1010
- Your work is related to an issue. **Pull requests that do not have an associated issue will not be accepted.**
11+
- **The issue is not already assigned to another contributor.** We follow a "first assigned, first served" approach to avoid duplicated work. If you open a PR for an issue that someone else is already working on, your PR will be closed.
1112
- Your work adheres to the style guidelines and fits in with the rest of the codebase.
1213
- You ran the project locally and tested your changes. Pay special attention to any specific areas of the p5.js editor that may be affected by your changes. Does everything still work as before? Great!
1314

0 commit comments

Comments
 (0)