1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Use generics to better type TabbedView (#10726)

This commit is contained in:
Michael Telatynski
2023-04-27 12:55:29 +01:00
committed by GitHub
parent fcf2fe2c1d
commit a629ce3a53
12 changed files with 56 additions and 52 deletions

View File

@ -26,11 +26,11 @@ describe("<TabbedView />", () => {
const securityTab = new Tab("SECURITY", "Security", "security", <div>security</div>);
const defaultProps = {
tabLocation: TabLocation.LEFT,
tabs: [generalTab, labsTab, securityTab] as NonEmptyArray<Tab>,
tabs: [generalTab, labsTab, securityTab] as NonEmptyArray<Tab<any>>,
};
const getComponent = (props = {}): React.ReactElement => <TabbedView {...defaultProps} {...props} />;
const getTabTestId = (tab: Tab): string => `settings-tab-${tab.id}`;
const getTabTestId = (tab: Tab<string>): string => `settings-tab-${tab.id}`;
const getActiveTab = (container: HTMLElement): Element | undefined =>
container.getElementsByClassName("mx_TabbedView_tabLabel_active")[0];
const getActiveTabBody = (container: HTMLElement): Element | undefined =>