@payfit/unity-components
Version:
32 lines (31 loc) • 1.43 kB
TypeScript
import { PlayCtx } from '../../types/testing.js';
/**
* Factory function returning a set of helpers to test Unity BottomSheet components.
* It wires Storybook's `Play` context with convenient utilities to query,
* assert, and interact with bottom sheets rendered on the canvas.
* @param context The Storybook play context used to group steps and actions.
* @returns An object of helpers: `findBottomSheet`, `closeBottomSheet`, `assertBottomSheetIsClosed`, `assertElementExistsInBottomSheet`, and `triggerBottomSheetAction`.
*/
export declare const getTestingUtilsBottomSheet: (context: PlayCtx) => {
findBottomSheet: ({ title }: {
title: string;
}) => Promise<HTMLElement>;
closeBottomSheetWithDismissButton: ({ title, dismissButtonLabel, }: {
title: string;
dismissButtonLabel?: string;
}) => Promise<void>;
closeBottomSheetByClickingOutside: ({ title }: {
title: string;
}) => Promise<void>;
assertBottomSheetIsClosed: (bottomSheet: HTMLElement) => Promise<void>;
assertElementExistsInBottomSheet: ({ title, content, primaryActionLabel, secondaryActionLabel, }: {
title: string;
content?: string;
primaryActionLabel?: string;
secondaryActionLabel?: string;
}) => Promise<void>;
triggerFooterButtonAction: ({ title, buttonLabel, }: {
title: string;
buttonLabel: string;
}) => Promise<void>;
};