Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed tests for editable label #965

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('AnnotationList', () => {
</TaskAnnotatorContext.Provider>
);

xit('Must select another annotation if selectedAnnotationId is changed', () => {
it('Must select another annotation if selectedAnnotationId is changed', () => {
const firstAnnotationRowId = `${ANNOTATION_FLOW_ITEM_ID_PREFIX}${firstAnnotation.id}`;
const secondAnnotationRowId = `${ANNOTATION_FLOW_ITEM_ID_PREFIX}${secondAnnotation.id}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ import { ANNOTATION_PATH_SEPARATOR } from '../constants';
import { ANNOTATION_FLOW_ITEM_ID_PREFIX } from 'shared/constants/annotations';
import { stringToRGBA } from 'shared/components/annotator/utils/string-to-rgba';

jest.mock('connectors/task-annotator-connector/task-annotator-context', () => ({
useTaskAnnotatorContext: () => ({
allAnnotations: { '1': [{}, {}] },
currentPage: 1,
onAnnotationEdited: () => {}
})
}));

describe('AnnotationRow', () => {
const props = {
id: '1',
Expand All @@ -27,7 +35,7 @@ describe('AnnotationRow', () => {
boundType: 'text' as AnnotationBoundType,
bound: { y: 10, x: 100, width: 0, height: 0 }
};
xit('Must render annotation with full path', () => {
it('Must render annotation with full path', () => {
const { getByText, getByTestId } = render(<AnnotationRow {...props} />);

const path = getByTestId('flow-path');
Expand All @@ -40,7 +48,7 @@ describe('AnnotationRow', () => {
expect(text).toBeVisible();
expect(label).toBeVisible();
});
xit('Must render annotation label with proper color', () => {
it('Must render annotation label with proper color', () => {
const { getById, rerender } = render(<AnnotationRow {...props} />);

const rowContainer = getById(`${ANNOTATION_FLOW_ITEM_ID_PREFIX}${props.id}`);
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/task/task-sidebar-flow/annotationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Annotation } from 'shared';
import { useOutsideClick } from 'shared/helpers/utils';

import { ReactComponent as closeIcon } from '@epam/assets/icons/common/navigation-close-12.svg';
import { IconButton, Text, TextArea, TextInput } from '@epam/loveship';
import { IconButton, Text, TextArea } from '@epam/loveship';
import { cx } from '@epam/uui';
import { ReactComponent as ContentEditFillIcon } from '@epam/assets/icons/common/content-edit-24.svg';

Expand Down Expand Up @@ -65,7 +65,7 @@ export const AnnotationRow: FC<TAnnotationProps> = ({

useEffect(() => {
if (allAnnotations) {
const ann = allAnnotations[currentPage].find((ann: any) => {
const ann = allAnnotations[currentPage]?.find((ann: Annotation) => {
return ann.id === id;
});
setAnnotation(ann);
Expand Down Expand Up @@ -139,7 +139,7 @@ export const AnnotationRow: FC<TAnnotationProps> = ({
</Text>
)}
{isEditMode && (
<form onSubmit={() => setIsEditMode(false)}>
<form onSubmit={() => setIsEditMode(false)} className={styles.textAreaForm}>
<TextArea
value={annotationText}
autoSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
overflow: unset;
text-overflow: unset;
word-break: break-word;
min-height: 36px;
}

.toolbar {
Expand Down Expand Up @@ -207,3 +208,7 @@
.editIcon:hover {
fill: #008ace;
}

.textAreaForm {
min-height: 36px;
}