From 11c93f597a62930d97c4d28e6bcf7e3736634444 Mon Sep 17 00:00:00 2001 From: GermanVor Date: Thu, 12 Dec 2024 21:18:32 +0100 Subject: [PATCH] chore: add qa for AdaptiveTabs --- src/components/AdaptiveTabs/AdaptiveTabs.tsx | 6 +++++- src/components/AdaptiveTabs/README.md | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/AdaptiveTabs/AdaptiveTabs.tsx b/src/components/AdaptiveTabs/AdaptiveTabs.tsx index d01dcbe5..dd05ec83 100644 --- a/src/components/AdaptiveTabs/AdaptiveTabs.tsx +++ b/src/components/AdaptiveTabs/AdaptiveTabs.tsx @@ -91,6 +91,7 @@ export type TabItem = T & { title?: React.ReactNode; hint?: string; disabled?: boolean; + qa?: string; }; export type TabsSize = 'm' | 'l' | 'xl'; @@ -119,6 +120,7 @@ export interface AdaptiveTabsProps { allowNotSelected?: boolean; /** Settings to control popup with hidden tabs list */ moreControlProps?: Pick; + qa?: string; } interface AdaptiveTabsState { @@ -867,6 +869,7 @@ export class AdaptiveTabs extends React.Component, Adapt this.onTabClick(item.id, e); } }} + data-qa={item.qa} > {wrapTo ? wrapTo(item, tabNode, tabIndex) : tabNode} @@ -939,7 +942,7 @@ export class AdaptiveTabs extends React.Component, Adapt } render() { - const {items, className, size = 'm'} = this.props; + const {items, className, size = 'm', qa} = this.props; return (
extends React.Component, Adapt }, [className], )} + data-qa={qa} > {(this.state.currentContainerWidthName === SMALL_CONTAINER_WIDTH_NAME || this.state.firstHiddenTabIndex === 0) && diff --git a/src/components/AdaptiveTabs/README.md b/src/components/AdaptiveTabs/README.md index 7eaab2d7..6047c880 100644 --- a/src/components/AdaptiveTabs/README.md +++ b/src/components/AdaptiveTabs/README.md @@ -10,6 +10,7 @@ with the caption `More'. If only one tab fits, the select is displayed instead o | id | `String` | `true` | | Tab's ID | | title | `String`, `React.ReactNode` | | | Tab's text | | disabled | `Boolean` | | | Indicates that the user cannot interact with the tab | +| qa | `String` | | | HTML data-qa attribute, used in tests | ### AdaptiveTabs PropTypes @@ -24,6 +25,7 @@ with the caption `More'. If only one tab fits, the select is displayed instead o | className | `String` | | | Class name for the tabs container | | [breakpointsConfig](#breakpointsConfig) | `Record` | | | Breakpoints config which control the thersholds of tab size. | | moreControlProps | `{popupWidth?: 'fit' \| number; virtualizationThreshold?: number;}` | | | Settings to control popup with hidden tabs list | +| qa | `String` | | | HTML data-qa attribute, used in tests | ### breakpointsConfig