Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aazaliyaa committed Sep 6, 2024
1 parent 9f69e54 commit 3759b07
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
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;
}

0 comments on commit 3759b07

Please sign in to comment.