Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/@react-spectrum/s2/chromatic/ListView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import {ActionButton, ActionButtonGroup, ActionMenu, Content, Heading, IllustratedMessage, Image, ListView, ListViewItem, MenuItem, Text} from '../src';
import {checkers} from './check';
import Delete from '../s2wf-icons/S2_Icon_Delete_20_N.svg';
import {DragBetweenLists, Reorderable} from '../stories/ListView.stories';
import Edit from '../s2wf-icons/S2_Icon_Edit_20_N.svg';
import {expect, userEvent, within} from 'storybook/test';
import File from '../s2wf-icons/S2_Icon_File_20_N.svg';
import Folder from '../s2wf-icons/S2_Icon_Folder_20_N.svg';
import FolderOpen from '../spectrum-illustrations/linear/FolderOpen';
Expand Down Expand Up @@ -253,3 +255,45 @@ export const EmptyState: Story = {
</ListView>
)
};

export const InsertionIndicator: Story = {
...Reorderable,
play: async ({canvasElement}) => {
await userEvent.tab();
await userEvent.keyboard('[Tab]');
// TODO: strangely enough tabbing via user event actually focuses the drag handle and not just the row
// can't reproduce manually
// await userEvent.keyboard('[ArrowRight]');
await userEvent.keyboard('[Enter]');
let body = canvasElement.ownerDocument.body;
await within(body).findByText('Insert between Adobe Photoshop and Adobe XD');
}
};

export const RootDrop: Story = {
...DragBetweenLists,
play: async () => {
await userEvent.tab();
await userEvent.keyboard('[Tab]');
// await userEvent.keyboard('[ArrowRight]');
await userEvent.keyboard('[Enter]');
await userEvent.keyboard('[Tab]');
expect(document.activeElement).toHaveRole('button');
expect(document.activeElement).toHaveAttribute('aria-label', 'Drop on');
}
};

export const OnFolderDrop: Story = {
...DragBetweenLists,
play: async () => {
await userEvent.tab();
await userEvent.keyboard('[Tab]');
// await userEvent.keyboard('[ArrowRight]');
await userEvent.keyboard('[Enter]');
await userEvent.keyboard('[Tab]');
await userEvent.keyboard('[ArrowDown]');
await userEvent.keyboard('[ArrowDown]');
expect(document.activeElement).toHaveRole('button');
expect(document.activeElement).toHaveAttribute('aria-label', 'Drop on Pictures');
}
};
Loading
Loading