Skip to content

Commit 7532d1b

Browse files
committed
Revert some unwanted changes
1 parent 145f7ca commit 7532d1b

File tree

7 files changed

+21
-25
lines changed

7 files changed

+21
-25
lines changed

__tests__/components/OverlaySettings.test.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,20 @@ const mockTheme = {
2222

2323
// Mocked MUI slider for easier testing, taken from
2424
// https://stackoverflow.com/a/61628815 (CC BY-SA 4.0)
25-
jest.mock(
26-
'@material-ui/core/Slider',
27-
() =>
28-
function (props) {
29-
const { id, name, min, max, onChange } = props;
30-
return (
31-
<input
32-
data-testid="opacity-slider"
33-
type="range"
34-
id={id}
35-
name={name}
36-
min={min}
37-
max={max}
38-
onChange={(event) => onChange(event, event.target.value)}
39-
/>
40-
);
41-
},
42-
);
25+
jest.mock('@material-ui/core/Slider', () => (props) => {
26+
const { id, name, min, max, onChange } = props;
27+
return (
28+
<input
29+
data-testid="opacity-slider"
30+
type="range"
31+
id={id}
32+
name={name}
33+
min={min}
34+
max={max}
35+
onChange={(event) => onChange(event, event.target.value)}
36+
/>
37+
);
38+
});
4339

4440
/** Render a bubble to the testing screen */
4541
function renderSettings(props = {}, renderFn = render) {

__tests__/lib/ocrFormats.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import contentAsTextAnnos from '../../__fixtures__/anno_iifv2.json';
1111
* https://stackoverflow.com/a/53464807 (CC-BY-SA)
1212
*/
1313
const closeTo = (expected, precision = 1) => ({
14-
asymmetricMatch: (actual) => Math.abs(expected - actual) < 10 ** -precision / 2,
14+
asymmetricMatch: (actual) => Math.abs(expected - actual) < Math.pow(10, -precision) -precision / 2,
1515
});
1616

1717
describe('parsing ALTO', () => {

src/components/settings/ButtonContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
3434
});
3535

3636
/** Container for a settings button */
37-
function ButtonContainer({ children, withBorder, paddingPrev, paddingNext }) {
37+
const ButtonContainer = ({ children, withBorder, paddingPrev, paddingNext }) => {
3838
const classes = useStyles({ withBorder, paddingPrev, paddingNext });
3939
return <div className={classes.root}>{children}</div>;
4040
}

src/components/settings/ColorInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const useStyles = makeStyles({
3737
});
3838

3939
/** Input to select a color */
40-
function ColorInput({ color, onChange, title, autoColors, className }) {
40+
const ColorInput = ({ color, onChange, title, autoColors, className }) => {
4141
const classes = useStyles({ color, autoColors });
4242
// We rely on the browser behavior that clicking on an input's label is equivalent
4343
// to clicking the input to show a custom color picker button.

src/components/settings/ColorWidget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
5757
});
5858

5959
/** Widget to update text and background color */
60-
function ColorWidget({ textColor, bgColor, onChange, t, pageColors, useAutoColors, containerId }) {
60+
const ColorWidget = ({ textColor, bgColor, onChange, t, pageColors, useAutoColors, containerId }) => {
6161
const showResetButton =
6262
!useAutoColors && pageColors && pageColors.some((c) => c && (c.textColor || c.bgColor));
6363
const classes = useStyles({ showResetButton });

src/components/settings/OverlaySettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
4646
});
4747

4848
/** Control text overlay settings */
49-
function OverlaySettings({
49+
const OverlaySettings = ({
5050
windowTextOverlayOptions,
5151
imageToolsEnabled,
5252
textsAvailable,
@@ -55,7 +55,7 @@ function OverlaySettings({
5555
t,
5656
pageColors,
5757
containerId,
58-
}) {
58+
}) => {
5959
const {
6060
enabled,
6161
visible,

src/lib/color.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function luminance([r, g, b]) {
3535
if (vSrgb <= 0.03928) {
3636
return vSrgb / 12.92;
3737
}
38-
return ((vSrgb + 0.055) / 1.055) ** 2.4;
38+
return Math.pow((vSrgb + 0.055) / 1.055, 2.4);
3939
});
4040
return colors[0] * 0.2126 + colors[1] * 0.7152 + colors[2] * 0.0722;
4141
}

0 commit comments

Comments
 (0)