UNPKG

@patreon/studio

Version:

Patreon Studio Design System

62 lines (61 loc) 2.12 kB
import type { StoryFn } from '@storybook/react'; import React from 'react'; import type { TokenColorMode } from '../types/token-modes'; /** * Uses `@testing-library/react` to render components with the theme. */ export declare const renderWithTheme: (children: React.ReactElement, config?: { tokenColorMode?: TokenColorMode; }) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>; /** * Generates export for happo tests. * @param children * @example * export const example = happo(<Box {...props} />) */ export declare const happo: (children: React.ReactNode) => () => React.JSX.Element; /** * Utility for testing responsive style rules. * @example * expect(wrapper).toHaveStyleRule('width', '100%', testBreakpoint.md) */ export declare const testBreakpoint: { xs: { media: string; }; sm: { media: string; }; md: { media: string; }; lg: { media: string; }; xl: { media: string; }; xxl: { media: string; }; } & { xs: {}; }; /** * This is generated png image for use in happo tests */ export declare const happoTestImage: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAkCAYAAADPRbkKAAAAOGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAACoAIABAAAAAEAAAAwoAMABAAAAAEAAAAkAAAAAG2ff3QAAABcSURBVFjD7c+xEYAwDARBuSdyWlNrxBQlV0D044hVfqPfVV1TwXV3ZX2U1wIAAAAAAAAACAAzGaCeNxtwXwAAAAAAAAAAxwHzBagQEOYrew4AAAAAAADwG8CcAGwzS5HboVt+QgAAAABJRU5ErkJggg=="; interface State { isOpen: boolean; setIsOpen: (isOpen: boolean) => void; selectedItem: number; setSelectedItem: (selectedItem: number) => void; } /** * The `happoCompatibleState` function is a utility for creating stories * that are compatible with both Storybook and Happo. This papers over the * differences between the two environments by providing a consistent API * for managing basic state. */ export declare function happoCompatibleState(story: (state: State) => React.ReactElement, initialState?: Pick<State, 'isOpen' | 'selectedItem'>): StoryFn; export {};