fbredius/storybook

View on GitHub
examples/official-storybook/stories/demo/setup.stories.tsx

Summary

Maintainability
A
0 mins
Test Coverage
/* eslint-disable storybook/use-storybook-testing-library */
// @TODO: use addon-interactions and remove the rule disable above
import React from 'react';
import { screen } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';

const Input = () => <input data-testid="test-input" />;

export default {
  title: 'Other/Demo/Setup',
  component: Input,
};

export const WithPlay = {
  play: async () => {
    const inputs = screen.getAllByTestId('test-input');
    for (let i = 0; i < inputs.length; i += 1) {
      // eslint-disable-next-line no-await-in-loop
      await userEvent.type(inputs[i], 'asdfasdf', { delay: 10 });
    }
  },
};