+export const ReadingTime = ({readingTime, size = 's', id, qa}: ReadingTimeProps) => (
+
diff --git a/src/components/PostInfo/components/Save.tsx b/src/components/PostInfo/components/Save.tsx
index 9b8a5e8b..e2ed4be7 100644
--- a/src/components/PostInfo/components/Save.tsx
+++ b/src/components/PostInfo/components/Save.tsx
@@ -81,7 +81,7 @@ export const Save = ({
metrika.reachGoal(MetrikaCounter.CrossSite, metrikaGoal);
handleAnalytics();
}}
- data-qa={`${qa ? qa + '-' : ''}save`}
+ data-qa={qa}
>
diff --git a/src/contexts/PostPageContext.ts b/src/contexts/PostPageContext.ts
index 573e49ed..1f86d1f4 100644
--- a/src/contexts/PostPageContext.ts
+++ b/src/contexts/PostPageContext.ts
@@ -4,14 +4,16 @@ import {ShareOptions} from '@gravity-ui/components';
import {PostData} from '../models/common';
+export type LikesRoutineType = {
+ handleUserLike: () => void;
+ hasUserLike: boolean;
+ likesCount: number;
+};
+
export interface PostPageContextProps {
post: PostData;
suggestedPosts: PostData[];
- likes?: {
- handleUserLike: () => void;
- hasUserLike: boolean;
- likesCount: number;
- };
+ likes?: LikesRoutineType;
shareOptions?: ShareOptions[];
}
diff --git a/src/models/blocks.ts b/src/models/blocks.ts
index 2f1c28d6..f1d34283 100644
--- a/src/models/blocks.ts
+++ b/src/models/blocks.ts
@@ -51,7 +51,7 @@ export type MediaProps = ClassNameProps &
text?: string;
};
-export type MetaProps = {
+export type MetaProps = QAProps & {
locale: string;
theme?: TextTheme;
} & PaddingsYFMProps;
diff --git a/test-utils/constants.ts b/test-utils/constants.ts
index f4846ef2..dbcd7ff9 100644
--- a/test-utils/constants.ts
+++ b/test-utils/constants.ts
@@ -1,5 +1,17 @@
import {PaddingSize} from '../src/models/paddings';
export const PADDING_SIZES: PaddingSize[] = ['xs', 's', 'm', 'l', 'xl'];
+export const PADDING_TYPES: string[] = ['paddingTop', 'paddingBottom'];
+
+export const PADDING_SIZES_BY_PADDING_TYPE: Record[] = PADDING_TYPES.reduce(
+ (acc, optionKey) => {
+ const mappedPaddingSizes = PADDING_SIZES.map((paddingSize) => {
+ return {optionKey, paddingSize} as Record;
+ });
+
+ return [...acc, ...mappedPaddingSizes];
+ },
+ [] as Record[],
+);
export const ERROR_INPUT_DATA_MESSAGE = 'There are errors in input test data';
diff --git a/test-utils/shared/common.tsx b/test-utils/shared/common.tsx
index 96383c00..7959fbcd 100644
--- a/test-utils/shared/common.tsx
+++ b/test-utils/shared/common.tsx
@@ -11,7 +11,7 @@ type CommonTestInputType = {
paddingTop?: PaddingSize;
paddingBottom?: PaddingSize;
} & Required;
- options?: {qaId?: string};
+ options?: {qaId?: string; paddingKey?: string};
};
export const testCustomClassName = ({component: Component, props}: CommonTestInputType) => {
@@ -51,3 +51,14 @@ export const testPaddingBottom = ({
expect(component).toHaveClass(`bc-wrapper_padding-bottom_${props.paddingBottom}`);
};
+
+export const testPadding = ({component: Component, props, options}: CommonTestInputType) => {
+ render();
+ const component = screen.getByTestId(options?.qaId || props.qa);
+
+ const classSuffix = options?.paddingKey === 'paddingTop' ? 'top' : 'bottom';
+ const classEdning =
+ options?.paddingKey === 'paddingTop' ? props.paddingTop : props.paddingBottom;
+
+ expect(component).toHaveClass(`bc-wrapper_padding-${classSuffix}_${classEdning}`);
+};