Skip to content

Commit 573f4cd

Browse files
committed
Upgrade all packages
1 parent 04605f9 commit 573f4cd

File tree

3 files changed

+2914
-2247
lines changed

3 files changed

+2914
-2247
lines changed

package.json

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,31 @@
3636
"react": ">=0.14.9"
3737
},
3838
"devDependencies": {
39-
"@babel/core": "^7.6.2",
40-
"@babel/plugin-proposal-class-properties": "^7.5.5",
41-
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
42-
"@babel/plugin-transform-object-assign": "^7.2.0",
43-
"@babel/plugin-transform-react-jsx": "^7.3.0",
39+
"@babel/core": "^7.9.0",
40+
"@babel/plugin-proposal-class-properties": "^7.8.3",
41+
"@babel/plugin-transform-flow-strip-types": "^7.9.0",
42+
"@babel/plugin-transform-object-assign": "^7.8.3",
43+
"@babel/plugin-transform-react-jsx": "^7.9.4",
44+
"@babel/preset-env": "^7.9.5",
45+
"@babel/preset-flow": "^7.9.0",
46+
"@babel/preset-react": "^7.9.4",
47+
"@testing-library/react": "^10.0.3",
4448
"babel-core": "^7.0.0-bridge.0",
45-
"babel-jest": "^24.9.0",
46-
"babel-plugin-macros": "^2.6.1",
47-
"codegen.macro": "^3.0.0",
48-
"flow-bin": "^0.108.0",
49-
"globby": "^10.0.1",
50-
"husky": "^3.0.5",
51-
"jest": "^24.9.0",
52-
"lint-staged": "^9.4.0",
49+
"babel-jest": "^25.4.0",
50+
"babel-plugin-macros": "^2.8.0",
51+
"codegen.macro": "^4.0.0",
52+
"flow-bin": "^0.123.0",
53+
"globby": "^11.0.0",
54+
"husky": "^4.2.5",
55+
"jest": "^25.4.0",
56+
"lint-staged": "^10.1.7",
5357
"npm-run-all": "^4.1.5",
54-
"prettier": "^1.18.2",
55-
"prismjs": "^1.17.1",
56-
"react": "^16.9.0",
57-
"react-dom": "^16.9.0",
58-
"react-testing-library": "^8.0.1",
59-
"rollup": "^1.21.4",
60-
"rollup-plugin-babel": "^4.3.3",
58+
"prettier": "^2.0.5",
59+
"prismjs": "^1.20.0",
60+
"react": "^16.13.1",
61+
"react-dom": "^16.13.1",
62+
"rollup": "^2.7.2",
63+
"rollup-plugin-babel": "^4.4.0",
6164
"rollup-plugin-buble": "^0.19.8",
6265
"rollup-plugin-commonjs": "^10.1.0",
6366
"rollup-plugin-node-resolve": "^5.2.0",
Lines changed: 169 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,169 @@
1-
import React from "react";
2-
import { render, cleanup } from "react-testing-library";
3-
4-
import Highlight from "../Highlight";
5-
import defaultProps from "../../defaultProps";
6-
7-
const exampleCode = `
8-
(function someDemo() {
9-
var test = "Hello World!";
10-
console.log(test);
11-
})();
12-
13-
return () => <App />;
14-
`.trim();
15-
16-
describe("<Highlight />", () => {
17-
afterEach(cleanup);
18-
19-
describe("snapshots", () => {
20-
it("renders correctly", () => {
21-
const { container } = render(
22-
<Highlight {...defaultProps} code={exampleCode} language="jsx">
23-
{({ className, style, tokens, getLineProps, getTokenProps }) => (
24-
<pre className={className} style={style}>
25-
{tokens.map((line, i) => (
26-
<div {...getLineProps({ line, key: i })}>
27-
{line.map((token, key) => (
28-
<span {...getTokenProps({ token, key })} />
29-
))}
30-
</div>
31-
))}
32-
</pre>
33-
)}
34-
</Highlight>
35-
);
36-
37-
expect(container).toMatchSnapshot();
38-
});
39-
40-
it("renders unsupported languages correctly", () => {
41-
const { container } = render(
42-
<Highlight
43-
{...defaultProps}
44-
code={exampleCode}
45-
language="abcdefghijklmnop"
46-
>
47-
{({ className, style, tokens, getLineProps, getTokenProps }) => (
48-
<pre className={className} style={style}>
49-
{tokens.map((line, i) => (
50-
<div {...getLineProps({ line, key: i })}>
51-
{line.map((token, key) => (
52-
<span {...getTokenProps({ token, key })} />
53-
))}
54-
</div>
55-
))}
56-
</pre>
57-
)}
58-
</Highlight>
59-
);
60-
61-
expect(container).toMatchSnapshot();
62-
});
63-
64-
it("renders without style props when no theme is passed", () => {
65-
const { container } = render(
66-
<Highlight
67-
{...defaultProps}
68-
theme={undefined}
69-
code={exampleCode}
70-
language="jsx"
71-
>
72-
{({ className, style, tokens, getLineProps, getTokenProps }) => (
73-
<pre className={className} style={style}>
74-
{tokens.map((line, i) => (
75-
<div {...getLineProps({ line, key: i })}>
76-
{line.map((token, key) => (
77-
<span {...getTokenProps({ token, key })} />
78-
))}
79-
</div>
80-
))}
81-
</pre>
82-
)}
83-
</Highlight>
84-
);
85-
86-
expect(container.innerHTML.includes("style")).toBeFalsy();
87-
});
88-
});
89-
90-
describe("getLineProps", () => {
91-
it("transforms lineProps inputs correctly", () => {
92-
const input = {
93-
key: "line-1",
94-
style: { cssProp: "test" },
95-
className: "line-class",
96-
line: [{ types: ["punctuation"], content: "!" }],
97-
restPropsTest: true
98-
};
99-
100-
render(
101-
<Highlight {...defaultProps} code={exampleCode} language="jsx">
102-
{({ getLineProps }) => {
103-
const output = getLineProps(input);
104-
105-
expect(output).toEqual({
106-
key: "line-1",
107-
style: {
108-
cssProp: "test",
109-
backgroundColor: null,
110-
color: expect.any(String)
111-
},
112-
className: "token-line line-class",
113-
restPropsTest: true
114-
});
115-
116-
return null;
117-
}}
118-
</Highlight>
119-
);
120-
});
121-
});
122-
123-
describe("getTokenProps", () => {
124-
it("transforms tokenProps inputs correctly", () => {
125-
const input = {
126-
key: "token-1",
127-
style: { cssProp: "test" },
128-
className: "token-class",
129-
token: { types: ["punctuation"], content: "!" },
130-
restPropsTest: true
131-
};
132-
133-
render(
134-
<Highlight {...defaultProps} code={exampleCode} language="jsx">
135-
{({ getTokenProps }) => {
136-
const output = getTokenProps(input);
137-
138-
expect(output).toEqual({
139-
key: "token-1",
140-
style: { cssProp: "test", color: expect.any(String) },
141-
className: "token punctuation token-class",
142-
restPropsTest: true,
143-
children: "!"
144-
});
145-
146-
return null;
147-
}}
148-
</Highlight>
149-
);
150-
});
151-
152-
it("transforms constructor token style correctly", () => {
153-
// From https://github.com/FormidableLabs/prism-react-renderer/issues/11
154-
render(
155-
<Highlight {...defaultProps} code={"open Common;"} language="reason">
156-
{({ tokens, getTokenProps }) => {
157-
const line = tokens[0];
158-
const token = line[2];
159-
const output = getTokenProps({ token, key: 2 });
160-
161-
expect(typeof output.style).not.toBe("function");
162-
163-
return null;
164-
}}
165-
</Highlight>
166-
);
167-
});
168-
});
169-
});
1+
import React from "react";
2+
import { render, cleanup } from "@testing-library/react";
3+
4+
import Highlight from "../Highlight";
5+
import defaultProps from "../../defaultProps";
6+
7+
const exampleCode = `
8+
(function someDemo() {
9+
var test = "Hello World!";
10+
console.log(test);
11+
})();
12+
13+
return () => <App />;
14+
`.trim();
15+
16+
describe("<Highlight />", () => {
17+
afterEach(cleanup);
18+
19+
describe("snapshots", () => {
20+
it("renders correctly", () => {
21+
const { container } = render(
22+
<Highlight {...defaultProps} code={exampleCode} language="jsx">
23+
{({ className, style, tokens, getLineProps, getTokenProps }) => (
24+
<pre className={className} style={style}>
25+
{tokens.map((line, i) => (
26+
<div {...getLineProps({ line, key: i })}>
27+
{line.map((token, key) => (
28+
<span {...getTokenProps({ token, key })} />
29+
))}
30+
</div>
31+
))}
32+
</pre>
33+
)}
34+
</Highlight>
35+
);
36+
37+
expect(container).toMatchSnapshot();
38+
});
39+
40+
it("renders unsupported languages correctly", () => {
41+
const { container } = render(
42+
<Highlight
43+
{...defaultProps}
44+
code={exampleCode}
45+
language="abcdefghijklmnop"
46+
>
47+
{({ className, style, tokens, getLineProps, getTokenProps }) => (
48+
<pre className={className} style={style}>
49+
{tokens.map((line, i) => (
50+
<div {...getLineProps({ line, key: i })}>
51+
{line.map((token, key) => (
52+
<span {...getTokenProps({ token, key })} />
53+
))}
54+
</div>
55+
))}
56+
</pre>
57+
)}
58+
</Highlight>
59+
);
60+
61+
expect(container).toMatchSnapshot();
62+
});
63+
64+
it("renders without style props when no theme is passed", () => {
65+
const { container } = render(
66+
<Highlight
67+
{...defaultProps}
68+
theme={undefined}
69+
code={exampleCode}
70+
language="jsx"
71+
>
72+
{({ className, style, tokens, getLineProps, getTokenProps }) => (
73+
<pre className={className} style={style}>
74+
{tokens.map((line, i) => (
75+
<div {...getLineProps({ line, key: i })}>
76+
{line.map((token, key) => (
77+
<span {...getTokenProps({ token, key })} />
78+
))}
79+
</div>
80+
))}
81+
</pre>
82+
)}
83+
</Highlight>
84+
);
85+
86+
expect(container.innerHTML.includes("style")).toBeFalsy();
87+
});
88+
});
89+
90+
describe("getLineProps", () => {
91+
it("transforms lineProps inputs correctly", () => {
92+
const input = {
93+
key: "line-1",
94+
style: { cssProp: "test" },
95+
className: "line-class",
96+
line: [{ types: ["punctuation"], content: "!" }],
97+
restPropsTest: true,
98+
};
99+
100+
render(
101+
<Highlight {...defaultProps} code={exampleCode} language="jsx">
102+
{({ getLineProps }) => {
103+
const output = getLineProps(input);
104+
105+
expect(output).toEqual({
106+
key: "line-1",
107+
style: {
108+
cssProp: "test",
109+
backgroundColor: null,
110+
color: expect.any(String),
111+
},
112+
className: "token-line line-class",
113+
restPropsTest: true,
114+
});
115+
116+
return null;
117+
}}
118+
</Highlight>
119+
);
120+
});
121+
});
122+
123+
describe("getTokenProps", () => {
124+
it("transforms tokenProps inputs correctly", () => {
125+
const input = {
126+
key: "token-1",
127+
style: { cssProp: "test" },
128+
className: "token-class",
129+
token: { types: ["punctuation"], content: "!" },
130+
restPropsTest: true,
131+
};
132+
133+
render(
134+
<Highlight {...defaultProps} code={exampleCode} language="jsx">
135+
{({ getTokenProps }) => {
136+
const output = getTokenProps(input);
137+
138+
expect(output).toEqual({
139+
key: "token-1",
140+
style: { cssProp: "test", color: expect.any(String) },
141+
className: "token punctuation token-class",
142+
restPropsTest: true,
143+
children: "!",
144+
});
145+
146+
return null;
147+
}}
148+
</Highlight>
149+
);
150+
});
151+
152+
it("transforms constructor token style correctly", () => {
153+
// From https://github.com/FormidableLabs/prism-react-renderer/issues/11
154+
render(
155+
<Highlight {...defaultProps} code={"open Common;"} language="reason">
156+
{({ tokens, getTokenProps }) => {
157+
const line = tokens[0];
158+
const token = line[2];
159+
const output = getTokenProps({ token, key: 2 });
160+
161+
expect(typeof output.style).not.toBe("function");
162+
163+
return null;
164+
}}
165+
</Highlight>
166+
);
167+
});
168+
});
169+
});

0 commit comments

Comments
 (0)