Skip to content

Commit dc39b9d

Browse files
committed
Update constant name and remove future tag on non-future test
1 parent f12f1e0 commit dc39b9d

File tree

6 files changed

+36
-39
lines changed

6 files changed

+36
-39
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,24 +369,24 @@ export function App() {
369369
### Children
370370

371371
To render a component on top of the sketch, you can add it as a child of the
372-
`ReactP5Wrapper` component and then use the exported `wrapperClassName` constant
373-
in your to style one element above the other via css.
372+
`ReactP5Wrapper` component and then use the exported `P5WrapperClassName`
373+
constant in your to style one element above the other via css.
374374

375375
For instance using [styled components](https://styled-components.com), for
376376
example, we could center some text on top of our sketch like so:
377377

378378
```jsx
379-
import { ReactP5Wrapper, wrapperClassName } from "../src/index.tsx";
379+
import { ReactP5Wrapper, P5WrapperClassName } from "../src/index.tsx";
380380
import styled, { createGlobalStyle } from "styled-components";
381381

382382
const GlobalWrapperStyles = createGlobalStyle`
383-
.${wrapperClassName} {
383+
.${P5WrapperClassName} {
384384
position: relative;
385385
}
386386
`;
387387

388388
const StyledCentredText = styled.span`
389-
.${wrapperClassName} & {
389+
.${P5WrapperClassName} & {
390390
position: absolute;
391391
top: 50%;
392392
left: 50%;

package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@
8080
"@testing-library/react": "^12.1.5",
8181
"@types/deep-equal": "^1.0.1",
8282
"@types/jest": "^27.5.2",
83-
"@types/react": "^17.0.46",
83+
"@types/react": "^17.0.47",
8484
"@types/react-dom": "^17.0.17",
8585
"@typescript-eslint/eslint-plugin": "^5.28.0",
8686
"@typescript-eslint/parser": "^5.28.0",
8787
"babel-loader": "^8.2.5",
8888
"babel-plugin-styled-components": "^2.0.7",
8989
"canvas": "^2.9.1",
9090
"css-loader": "^6.7.1",
91-
"eslint": "^8.17.0",
91+
"eslint": "^8.18.0",
9292
"eslint-config-prettier": "^8.5.0",
9393
"eslint-plugin-prettier": "^4.0.0",
9494
"eslint-plugin-react": "^7.30.0",
@@ -107,12 +107,9 @@
107107
"style-loader": "^3.3.1",
108108
"ts-jest": "^27.1.5",
109109
"ts-loader": "^9.3.0",
110-
"typescript": "^4.7.3",
110+
"typescript": "^4.7.4",
111111
"webpack": "^5.73.0",
112112
"webpack-cli": "^4.10.0",
113113
"webpack-dev-server": "^4.9.2"
114-
},
115-
"resolutions": {
116-
"styled-components": "^5"
117114
}
118115
}

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type P5CanvasInstance<Props extends SketchProps = SketchProps> = p5 & {
2222
export type P5Instance<Props extends SketchProps = SketchProps> =
2323
P5CanvasInstance<Props>;
2424

25-
export const wrapperClassName = "react-p5-wrapper";
25+
export const P5WrapperClassName = "react-p5-wrapper";
2626
export const ReactP5Wrapper = memo(ReactP5WrapperComponent, propsAreEqual);
2727

2828
function createCanvasInstance<Props extends SketchProps = SketchProps>(
@@ -95,7 +95,7 @@ function ReactP5WrapperComponent<Props extends SketchProps = SketchProps>({
9595
useIsomorphicEffect(() => () => removeCanvasInstance(canvasInstanceRef), []);
9696

9797
return (
98-
<div ref={wrapperRef} className={wrapperClassName}>
98+
<div ref={wrapperRef} className={P5WrapperClassName}>
9999
{children}
100100
</div>
101101
);

tests/exports.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React, { createFactory } from "react";
22

3-
import { ReactP5Wrapper, wrapperClassName } from "../src";
3+
import { ReactP5Wrapper, P5WrapperClassName } from "../src";
44

55
describe("Exports", () => {
66
it("should export the css class name used on the wrapper", () => {
7-
expect(wrapperClassName).not.toBeUndefined();
7+
expect(P5WrapperClassName).not.toBeUndefined();
88
});
99

1010
it("should export the css class name used on the wrapper as a non-empty string", () => {
11-
expect(typeof wrapperClassName).toBe("string");
12-
expect(wrapperClassName.length).toBeGreaterThan(0);
11+
expect(typeof P5WrapperClassName).toBe("string");
12+
expect(P5WrapperClassName.length).toBeGreaterThan(0);
1313
});
1414

1515
it("should export the wrapper component", () => {

tests/rendering.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe("Rendering", () => {
9090
expect(content).toBe('<div class="react-p5-wrapper"></div>');
9191
});
9292

93-
it("[General] [Future] should throw an error when the `sketch` prop is not provided", () => {
93+
it("[General] should throw an error when the `sketch` prop is not provided", () => {
9494
expect(() => render(<ReactP5Wrapper />)).toThrow(/sketch/);
9595
});
9696

0 commit comments

Comments
 (0)