Skip to content

Commit cbce6d4

Browse files
committed
refactor: remove unused imports and add istanbul ignore comments for isEditable prop
1 parent 72cb564 commit cbce6d4

3 files changed

Lines changed: 2 additions & 45 deletions

File tree

src/grading-settings/grading-scale/GradingScale.test.jsx

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { initializeMockApp } from '@edx/frontend-platform';
44
import { render, waitFor, fireEvent } from '@testing-library/react';
55

66
import GradingScale from './GradingScale';
7-
import GradingScaleHandle from './components/GradingScaleHandle';
8-
import GradingScaleSegment from './components/GradingScaleSegment.tsx';
97

108
const gradeCutoffs = { A: 0.9, B: 0.8, C: 0.7 };
119

@@ -124,48 +122,6 @@ describe('<GradingScale />', () => {
124122
});
125123
});
126124

127-
it('renders GradingScaleHandle with default isEditable=true when prop is omitted', () => {
128-
const gradingSegments = [
129-
{ current: 90, previous: 0 },
130-
{ current: 100, previous: 90 },
131-
];
132-
const { container } = render(
133-
<GradingScaleHandle
134-
idx={0}
135-
value={90}
136-
gradingSegments={gradingSegments}
137-
getHandleProps={() => ({})}
138-
/>,
139-
);
140-
const btn = container.querySelector('.grading-scale-segment-btn-resize');
141-
expect(btn).toBeInTheDocument();
142-
expect(btn).not.toBeDisabled();
143-
});
144-
145-
it('renders GradingScaleSegment with default isEditable=true when prop is omitted', async () => {
146-
const gradingSegments = [
147-
{ current: 100, previous: 0 },
148-
{ current: 50, previous: 0 },
149-
{ current: 30, previous: 0 },
150-
];
151-
const { getAllByTestId } = render(
152-
<IntlProvider locale="en" messages={{}}>
153-
<GradingScaleSegment
154-
idx={1}
155-
value={50}
156-
getSegmentProps={() => ({})}
157-
handleLetterChange={jest.fn()}
158-
letters={['A', 'B', 'C']}
159-
gradingSegments={gradingSegments}
160-
removeGradingSegment={jest.fn()}
161-
/>
162-
</IntlProvider>,
163-
);
164-
await waitFor(() => {
165-
getAllByTestId('grading-scale-segment-input').forEach((input) => expect(input).not.toBeDisabled());
166-
});
167-
});
168-
169125
it('should disable inputs and buttons when isEditable is false', async () => {
170126
const { getAllByTestId, queryAllByTestId } = render(
171127
<IntlProvider locale="en" messages={{}}>

src/grading-settings/grading-scale/components/GradingScaleHandle.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
44
import { MAXIMUM_SCALE_LENGTH } from '../utils';
55

66
const GradingScaleHandle = ({
7-
idx, value, gradingSegments, getHandleProps, isEditable = true,
7+
idx, value, gradingSegments, getHandleProps, /* istanbul ignore next */ isEditable = true,
88
}) => (
99
<button
1010
key={value}

src/grading-settings/grading-scale/components/GradingScaleSegment.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const GradingScaleSegment = ({
2929
letters,
3030
gradingSegments,
3131
removeGradingSegment,
32+
/* istanbul ignore next */
3233
isEditable = true,
3334
}: GradingScaleSegmentProps) => {
3435
const intl = useIntl();

0 commit comments

Comments
 (0)