Skip to content

Commit

Permalink
chore: add qa for AdaptiveTabs
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor committed Dec 12, 2024
1 parent 2602ff7 commit 11c93f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/AdaptiveTabs/AdaptiveTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type TabItem<T> = T & {
title?: React.ReactNode;
hint?: string;
disabled?: boolean;
qa?: string;
};

export type TabsSize = 'm' | 'l' | 'xl';
Expand Down Expand Up @@ -119,6 +120,7 @@ export interface AdaptiveTabsProps<T> {
allowNotSelected?: boolean;
/** Settings to control popup with hidden tabs list */
moreControlProps?: Pick<SelectProps, 'virtualizationThreshold' | 'popupWidth'>;
qa?: string;
}

interface AdaptiveTabsState {
Expand Down Expand Up @@ -867,6 +869,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
this.onTabClick(item.id, e);
}
}}
data-qa={item.qa}
>
{wrapTo ? wrapTo(item, tabNode, tabIndex) : tabNode}
</div>
Expand Down Expand Up @@ -939,7 +942,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
}

render() {
const {items, className, size = 'm'} = this.props;
const {items, className, size = 'm', qa} = this.props;

return (
<div
Expand All @@ -951,6 +954,7 @@ export class AdaptiveTabs<T> extends React.Component<AdaptiveTabsProps<T>, Adapt
},
[className],
)}
data-qa={qa}
>
{(this.state.currentContainerWidthName === SMALL_CONTAINER_WIDTH_NAME ||
this.state.firstHiddenTabIndex === 0) &&
Expand Down
2 changes: 2 additions & 0 deletions src/components/AdaptiveTabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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<string, number>` | | | 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

Expand Down

0 comments on commit 11c93f5

Please sign in to comment.