Skip to content

Commit 4ffc471

Browse files
committed
fix test errors in SketchList
1 parent 3ce1cb4 commit 4ffc471

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

client/modules/IDE/components/SketchList.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import classNames from 'classnames';
33
import React, { useEffect, useState, useCallback } from 'react';
44
import { Helmet } from 'react-helmet';
55
import { connect } from 'react-redux';
6+
import { useTranslation } from 'react-i18next';
67
import { bindActionCreators } from 'redux';
78
import * as ProjectsActions from '../actions/projects'; // Added Projects actions
89
import * as CollectionsActions from '../actions/collections'; // Added Collections actions
@@ -25,11 +26,11 @@ const SketchList = ({
2526
sorting,
2627
toggleDirectionForField,
2728
resetSorting,
28-
t,
2929
mobile
3030
}) => {
3131
const [isInitialDataLoad, setIsInitialDataLoad] = useState(true);
3232
const [sketchToAddToCollection, setSketchToAddToCollection] = useState(null);
33+
const { t } = useTranslation();
3334

3435
useEffect(() => {
3536
getProjects(username);
@@ -98,11 +99,13 @@ const SketchList = ({
9899
{field === fieldName &&
99100
(direction === SortingActions.DIRECTION.ASC ? (
100101
<ArrowUpIcon
102+
focusable="false"
101103
role="img"
102104
aria-label={t('SketchList.DirectionAscendingARIA')}
103105
/>
104106
) : (
105107
<ArrowDownIcon
108+
focusable="false"
106109
role="img"
107110
aria-label={t('SketchList.DirectionDescendingARIA')}
108111
/>
@@ -192,8 +195,7 @@ SketchList.propTypes = {
192195
field: PropTypes.string.isRequired,
193196
direction: PropTypes.string.isRequired
194197
}).isRequired,
195-
mobile: PropTypes.bool,
196-
t: PropTypes.func.isRequired
198+
mobile: PropTypes.bool
197199
};
198200

199201
SketchList.defaultProps = {

client/modules/IDE/components/SketchList.unit.test.jsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ import SketchList from './SketchList';
88
import { reduxRender, fireEvent, screen, within } from '../../../test-utils';
99
import { initialTestState } from '../../../testData/testReduxStore';
1010

11-
jest.mock('react-i18next', () => ({
12-
useTranslation: () => ({
13-
t: (key) => key,
14-
i18n: {
15-
changeLanguage: jest.fn(),
16-
language: 'en-US'
17-
}
18-
}),
19-
initReactI18next: {
20-
type: '3rdParty',
21-
init: jest.fn()
22-
}
23-
}));
24-
25-
jest.mock('../../../i18n');
26-
2711
const server = setupServer(
2812
rest.get(`/${initialTestState.user.username}/projects`, (req, res, ctx) =>
2913
// it just needs to return something so it doesn't throw an error

client/modules/User/pages/DashboardView.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,7 @@ const DashboardView = () => {
107107
case TabKey.sketches:
108108
default:
109109
return (
110-
<SketchList
111-
key={username}
112-
mobile={mobile}
113-
username={username}
114-
t={t}
115-
/>
110+
<SketchList key={username} mobile={mobile} username={username} />
116111
);
117112
}
118113
};

0 commit comments

Comments
 (0)