import * as React from "react"; import type { ComponentStory, ComponentMeta } from "@storybook/react"; import { LayoutMap } from "../src"; import { within, userEvent, fireEvent, getByTestId } from "@storybook/testing-library"; import { expect } from "@storybook/jest"; export default { title: "lib/LayoutMap", component: LayoutMap, parameters: { layout: "fullscreen" } } as ComponentMeta; const Template: ComponentStory = args => { return ; }; export const Normal = Template.bind({}); const Ticker = props => { return (
T
Draggable Area .aax-draggableHandle
); }; const TradingView = props => { return (
V
Draggable Area .draggableHandle
{ props.onResizeHandle(); }} > ResizeHandle
); }; const Entrust = props => { return (
E
Draggable Area .draggableHandle
); }; const defaultStyles = () => ({ color: "#fff", height: "100%", background: `rgba(1, 1, 1, ${Math.random()})` }); export const Controls = Template.bind({}); Controls.args = { responsiveGridLayoutProps: { draggableHandle: ".draggableHandle" }, layoutsCacheName: "testOfWebExchangeInteractionsCache", views: { T: , V: , E: , L: (
L
), O: (
O
), } }; export const Interactions = Template.bind({}); Interactions.args = { responsiveGridLayoutProps: { draggableHandle: ".draggableHandle" }, layoutsCacheName: "testOfWebExchangeInteractionsCache", views: { T: , V: , E: , L: (
L
), O: (
O
), } }; Interactions.play = async ({ canvasElement }) => { // Starts querying the component from its root element const canvas = within(canvasElement); // See https://storybook.js.org/docs/react/essentials/actions#automatically-matching-args to learn how to setup logging in the Actions panel await userEvent.click(canvas.getByTestId("ticker-aax-draggableHandle")); await userEvent.dblClick(canvas.getByTestId("tradingView-draggableHandle")); await userEvent.click(canvas.getByTestId("entrust")); // 👇 Assert DOM structure // await expect( // canvas.getByText( // 'Everything is perfect. Your account is ready and we should probably get you started!' // ) // ).toBeInTheDocument(); };