@12-apps/ui 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -8
- package/src/button/index.ts +1 -0
- package/src/social-login-button/index.ts +1 -0
- package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
- package/src/user-avatar/index.ts +1 -0
- package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
- package/eslint.config.js +0 -89
- package/src/__tests__/data-grid.test.tsx +0 -125
- package/src/__tests__/package-wiring.test.ts +0 -41
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/social-login-button.test.tsx +0 -186
- package/src/__tests__/user-avatar.test.tsx +0 -195
- package/src/__tests__/viewport.test.ts +0 -50
- package/src/components/command/__tests__/command.test.tsx +0 -112
- package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
- package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
- package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
- package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
- package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
- package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
- package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
- package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
- package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
- package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
- package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
- package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
- package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
- package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
- package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
- package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
- package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
- package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
- package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
- package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
- package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
- package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
- package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
- package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
- package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
- package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
- package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
- package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
- package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
- package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
- package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
- package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
- package/src/components/data-display/Table/Table.stories.tsx +0 -803
- package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
- package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
- package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
- package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
- package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
- package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
- package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
- package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
- package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
- package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
- package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
- package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
- package/src/components/form/Button/Button.stories.tsx +0 -365
- package/src/components/form/Button/Button.test.stories.tsx +0 -607
- package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
- package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
- package/src/components/form/CepField/CepField.stories.tsx +0 -138
- package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
- package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
- package/src/components/form/Command/Command.stories.tsx +0 -580
- package/src/components/form/Command/Command.test.stories.tsx +0 -215
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
- package/src/components/form/Form/Form.stories.tsx +0 -687
- package/src/components/form/Form/Form.test.stories.tsx +0 -601
- package/src/components/form/Input/Input.stories.tsx +0 -260
- package/src/components/form/Input/Input.test.stories.tsx +0 -1191
- package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
- package/src/components/form/Label/Label.stories.tsx +0 -473
- package/src/components/form/Label/Label.test.stories.tsx +0 -915
- package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
- package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
- package/src/components/form/Select/Select.stories.tsx +0 -364
- package/src/components/form/Select/Select.test.stories.tsx +0 -985
- package/src/components/form/Slider/Slider.stories.tsx +0 -418
- package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
- package/src/components/form/Switch/Switch.stories.tsx +0 -697
- package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
- package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
- package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
- package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
- package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
- package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
- package/src/components/form/total-form/total-form.test.tsx +0 -214
- package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
- package/src/components/layout/Card/Card.stories.tsx +0 -591
- package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
- package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
- package/src/components/layout/Container/Container.stories.tsx +0 -557
- package/src/components/layout/Container/Container.test.stories.tsx +0 -745
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
- package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
- package/src/components/layout/Separator/Separator.stories.tsx +0 -563
- package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
- package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
- package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
- package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
- package/src/components/typography/Code/Code.stories.tsx +0 -686
- package/src/components/typography/Code/Code.test.stories.tsx +0 -703
- package/src/components/typography/Heading/Heading.stories.tsx +0 -451
- package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
- package/src/components/typography/Text/Text.stories.tsx +0 -359
- package/src/components/typography/Text/Text.test.stories.tsx +0 -759
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
- package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
- package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
- package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
- package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
- package/src/components/utility/Portal/Portal.stories.tsx +0 -340
- package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
- package/src/components/utility/Transition/Transition.stories.tsx +0 -493
- package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
- /package/src/{button.tsx → button/button.tsx} +0 -0
|
@@ -1,745 +0,0 @@
|
|
|
1
|
-
import { Box, Button, Card, CardContent,Paper, Typography } from '@mui/material';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { expect, fn,userEvent, within, waitFor } from 'storybook/test';
|
|
4
|
-
|
|
5
|
-
import { Container } from './Container';
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Container> = {
|
|
8
|
-
title: 'Layout/Container/Tests',
|
|
9
|
-
component: Container,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'fullscreen',
|
|
12
|
-
chromatic: { disableSnapshot: false }
|
|
13
|
-
},
|
|
14
|
-
tags: ['autodocs', 'test', 'component:Container']
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
|
|
20
|
-
// Test Content Components
|
|
21
|
-
const InteractiveContent = ({ onClick = fn() }: { onClick?: () => void }) => (
|
|
22
|
-
<Box data-testid="interactive-container">
|
|
23
|
-
<Button
|
|
24
|
-
data-testid="test-button"
|
|
25
|
-
onClick={onClick}
|
|
26
|
-
variant="contained"
|
|
27
|
-
sx={{ mb: 2 }}
|
|
28
|
-
>
|
|
29
|
-
Click Me
|
|
30
|
-
</Button>
|
|
31
|
-
<Paper
|
|
32
|
-
data-testid="hoverable-paper"
|
|
33
|
-
sx={{
|
|
34
|
-
p: 2,
|
|
35
|
-
cursor: 'pointer',
|
|
36
|
-
transition: 'all 0.2s ease',
|
|
37
|
-
'&:hover': {
|
|
38
|
-
transform: 'scale(1.02)',
|
|
39
|
-
opacity: 0.8
|
|
40
|
-
}
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<Typography>Hover over me</Typography>
|
|
44
|
-
</Paper>
|
|
45
|
-
</Box>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const AccessibilityContent = () => (
|
|
49
|
-
<Box>
|
|
50
|
-
<Typography
|
|
51
|
-
id="description-id"
|
|
52
|
-
variant="body2"
|
|
53
|
-
sx={{ mb: 2 }}
|
|
54
|
-
>
|
|
55
|
-
This is a description for screen readers
|
|
56
|
-
</Typography>
|
|
57
|
-
<Button
|
|
58
|
-
data-testid="accessible-button"
|
|
59
|
-
aria-label="Accessible test button"
|
|
60
|
-
aria-describedby="description-id"
|
|
61
|
-
variant="outlined"
|
|
62
|
-
>
|
|
63
|
-
Accessible Button
|
|
64
|
-
</Button>
|
|
65
|
-
<nav role="navigation" data-testid="test-nav" aria-label="Test navigation">
|
|
66
|
-
<Typography>Navigation content</Typography>
|
|
67
|
-
</nav>
|
|
68
|
-
<div role="status" aria-live="polite" data-testid="live-region">
|
|
69
|
-
Status updates appear here
|
|
70
|
-
</div>
|
|
71
|
-
</Box>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
// ==========================================
|
|
75
|
-
// 7.2 Interaction Tests
|
|
76
|
-
// ==========================================
|
|
77
|
-
|
|
78
|
-
export const BasicInteraction: Story = {
|
|
79
|
-
name: '🧪 Basic Interaction Test',
|
|
80
|
-
args: {
|
|
81
|
-
'data-testid': 'container-component',
|
|
82
|
-
children: <InteractiveContent onClick={fn()} />,
|
|
83
|
-
},
|
|
84
|
-
play: async ({ canvasElement, step }) => {
|
|
85
|
-
const canvas = within(canvasElement);
|
|
86
|
-
|
|
87
|
-
await step('Initial render verification', async () => {
|
|
88
|
-
const container = canvas.getByTestId('container-component');
|
|
89
|
-
await expect(container).toBeInTheDocument();
|
|
90
|
-
|
|
91
|
-
const interactiveContainer = canvas.getByTestId('interactive-container');
|
|
92
|
-
await expect(interactiveContainer).toBeInTheDocument();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
await step('Click interaction', async () => {
|
|
96
|
-
const button = canvas.getByTestId('test-button');
|
|
97
|
-
await userEvent.click(button);
|
|
98
|
-
// Note: onClick mock verification would require proper setup in real test
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
await step('Hover interaction', async () => {
|
|
102
|
-
const hoverableElement = canvas.getByTestId('hoverable-paper');
|
|
103
|
-
await userEvent.hover(hoverableElement);
|
|
104
|
-
|
|
105
|
-
// Verify hover styles are applied
|
|
106
|
-
await expect(hoverableElement).toBeInTheDocument();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
await step('Unhover interaction', async () => {
|
|
110
|
-
const hoverableElement = canvas.getByTestId('hoverable-paper');
|
|
111
|
-
await userEvent.unhover(hoverableElement);
|
|
112
|
-
await expect(hoverableElement).toBeInTheDocument();
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export const ContainerVariantInteraction: Story = {
|
|
118
|
-
name: '🔄 Container Variant State Test',
|
|
119
|
-
args: {
|
|
120
|
-
variant: 'default',
|
|
121
|
-
'data-testid': 'variant-container',
|
|
122
|
-
children: (
|
|
123
|
-
<Box>
|
|
124
|
-
<Typography data-testid="variant-indicator">Default variant active</Typography>
|
|
125
|
-
<Button data-testid="variant-button" variant="outlined">Test Button</Button>
|
|
126
|
-
</Box>
|
|
127
|
-
),
|
|
128
|
-
},
|
|
129
|
-
play: async ({ canvasElement, step }) => {
|
|
130
|
-
const canvas = within(canvasElement);
|
|
131
|
-
|
|
132
|
-
await step('Verify default variant state', async () => {
|
|
133
|
-
const container = canvas.getByTestId('variant-container');
|
|
134
|
-
await expect(container).toBeInTheDocument();
|
|
135
|
-
|
|
136
|
-
const indicator = canvas.getByTestId('variant-indicator');
|
|
137
|
-
await expect(indicator).toHaveTextContent('Default variant active');
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
await step('Verify button interaction in container', async () => {
|
|
141
|
-
const button = canvas.getByTestId('variant-button');
|
|
142
|
-
await userEvent.click(button);
|
|
143
|
-
await expect(button).toBeInTheDocument();
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
// ==========================================
|
|
149
|
-
// 7.3 Accessibility Tests
|
|
150
|
-
// ==========================================
|
|
151
|
-
|
|
152
|
-
export const KeyboardNavigation: Story = {
|
|
153
|
-
name: '⌨️ Keyboard Navigation Test',
|
|
154
|
-
args: {
|
|
155
|
-
'data-testid': 'keyboard-container',
|
|
156
|
-
children: (
|
|
157
|
-
<Box>
|
|
158
|
-
<Button data-testid="first-focusable" variant="contained" sx={{ mr: 2 }}>
|
|
159
|
-
First Button
|
|
160
|
-
</Button>
|
|
161
|
-
<Button data-testid="second-focusable" variant="outlined" sx={{ mr: 2 }}>
|
|
162
|
-
Second Button
|
|
163
|
-
</Button>
|
|
164
|
-
<input
|
|
165
|
-
data-testid="text-input"
|
|
166
|
-
type="text"
|
|
167
|
-
placeholder="Text input"
|
|
168
|
-
style={{ padding: '8px', marginRight: '8px' }}
|
|
169
|
-
/>
|
|
170
|
-
<button data-testid="native-button">Native Button</button>
|
|
171
|
-
</Box>
|
|
172
|
-
),
|
|
173
|
-
},
|
|
174
|
-
parameters: {
|
|
175
|
-
a11y: {
|
|
176
|
-
element: '#storybook-root',
|
|
177
|
-
config: {
|
|
178
|
-
rules: [
|
|
179
|
-
{ id: 'color-contrast', enabled: true },
|
|
180
|
-
{ id: 'aria-required-attr', enabled: true },
|
|
181
|
-
{ id: 'aria-roles', enabled: true },
|
|
182
|
-
{ id: 'aria-valid-attr-value', enabled: true },
|
|
183
|
-
{ id: 'button-name', enabled: true },
|
|
184
|
-
{ id: 'duplicate-id', enabled: true },
|
|
185
|
-
{ id: 'label', enabled: true }
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
play: async ({ canvasElement, step }) => {
|
|
191
|
-
const canvas = within(canvasElement);
|
|
192
|
-
|
|
193
|
-
await step('Tab navigation forward', async () => {
|
|
194
|
-
const firstButton = canvas.getByTestId('first-focusable');
|
|
195
|
-
const secondButton = canvas.getByTestId('second-focusable');
|
|
196
|
-
|
|
197
|
-
// Focus first element
|
|
198
|
-
await userEvent.click(firstButton);
|
|
199
|
-
await waitFor(() => expect(firstButton).toHaveFocus());
|
|
200
|
-
|
|
201
|
-
// Tab to next element
|
|
202
|
-
await userEvent.tab();
|
|
203
|
-
await waitFor(() => expect(secondButton).toHaveFocus());
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
await step('Tab navigation backward', async () => {
|
|
207
|
-
await userEvent.tab({ shift: true });
|
|
208
|
-
const firstButton = canvas.getByTestId('first-focusable');
|
|
209
|
-
await waitFor(() => expect(firstButton).toHaveFocus());
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
await step('Enter key activation', async () => {
|
|
213
|
-
const button = canvas.getByTestId('first-focusable');
|
|
214
|
-
await userEvent.click(button);
|
|
215
|
-
await userEvent.keyboard('{Enter}');
|
|
216
|
-
// Verify button is still focused after activation
|
|
217
|
-
await waitFor(() => expect(button).toHaveFocus());
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
await step('Space key activation', async () => {
|
|
221
|
-
const nativeButton = canvas.getByTestId('native-button');
|
|
222
|
-
await userEvent.click(nativeButton);
|
|
223
|
-
await userEvent.keyboard(' ');
|
|
224
|
-
await waitFor(() => expect(nativeButton).toHaveFocus());
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export const ScreenReaderTest: Story = {
|
|
230
|
-
name: '🔊 Screen Reader Test',
|
|
231
|
-
args: {
|
|
232
|
-
'aria-label': 'Test container',
|
|
233
|
-
'aria-describedby': 'description-id',
|
|
234
|
-
'data-testid': 'container',
|
|
235
|
-
children: <AccessibilityContent />,
|
|
236
|
-
},
|
|
237
|
-
play: async ({ canvasElement, step }) => {
|
|
238
|
-
const canvas = within(canvasElement);
|
|
239
|
-
|
|
240
|
-
await step('Verify ARIA labels', async () => {
|
|
241
|
-
const container = canvas.getByLabelText('Test container');
|
|
242
|
-
await expect(container).toBeInTheDocument();
|
|
243
|
-
await expect(container).toHaveAttribute('aria-label', 'Test container');
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
await step('Verify ARIA descriptions', async () => {
|
|
247
|
-
const container = canvas.getByTestId('container');
|
|
248
|
-
await expect(container).toHaveAttribute('aria-describedby', 'description-id');
|
|
249
|
-
|
|
250
|
-
const description = canvas.getByText('This is a description for screen readers');
|
|
251
|
-
await expect(description).toBeInTheDocument();
|
|
252
|
-
await expect(description).toHaveAttribute('id', 'description-id');
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
await step('Verify role attributes', async () => {
|
|
256
|
-
const nav = canvas.getByRole('navigation');
|
|
257
|
-
await expect(nav).toBeInTheDocument();
|
|
258
|
-
await expect(nav).toHaveAttribute('aria-label', 'Test navigation');
|
|
259
|
-
|
|
260
|
-
const button = canvas.getByRole('button');
|
|
261
|
-
await expect(button).toBeInTheDocument();
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
await step('Verify live regions', async () => {
|
|
265
|
-
const liveRegion = canvas.getByRole('status');
|
|
266
|
-
await expect(liveRegion).toHaveAttribute('aria-live', 'polite');
|
|
267
|
-
await expect(liveRegion).toBeInTheDocument();
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
export const FocusManagement: Story = {
|
|
273
|
-
name: '🎯 Focus Management Test',
|
|
274
|
-
args: {
|
|
275
|
-
'data-testid': 'focus-container',
|
|
276
|
-
children: (
|
|
277
|
-
<Box>
|
|
278
|
-
<Button data-testid="trigger-button" variant="contained" sx={{ mb: 2 }}>
|
|
279
|
-
Focus Trigger
|
|
280
|
-
</Button>
|
|
281
|
-
<Paper sx={{ p: 2, border: '2px solid', borderColor: 'primary.main' }}>
|
|
282
|
-
<Typography variant="h6" gutterBottom>Focusable Content</Typography>
|
|
283
|
-
<Button data-testid="first-focus-element" size="small" sx={{ mr: 1 }}>
|
|
284
|
-
First
|
|
285
|
-
</Button>
|
|
286
|
-
<Button data-testid="second-focus-element" size="small">
|
|
287
|
-
Second
|
|
288
|
-
</Button>
|
|
289
|
-
</Paper>
|
|
290
|
-
</Box>
|
|
291
|
-
),
|
|
292
|
-
},
|
|
293
|
-
play: async ({ canvasElement, step }) => {
|
|
294
|
-
const canvas = within(canvasElement);
|
|
295
|
-
|
|
296
|
-
await step('Initial focus state', async () => {
|
|
297
|
-
const triggerButton = canvas.getByTestId('trigger-button');
|
|
298
|
-
await userEvent.click(triggerButton);
|
|
299
|
-
await waitFor(() => expect(triggerButton).toHaveFocus());
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
await step('Focus cycling through elements', async () => {
|
|
303
|
-
await userEvent.tab();
|
|
304
|
-
const firstElement = canvas.getByTestId('first-focus-element');
|
|
305
|
-
await waitFor(() => expect(firstElement).toHaveFocus());
|
|
306
|
-
|
|
307
|
-
await userEvent.tab();
|
|
308
|
-
const secondElement = canvas.getByTestId('second-focus-element');
|
|
309
|
-
await waitFor(() => expect(secondElement).toHaveFocus());
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
await step('Focus restoration', async () => {
|
|
313
|
-
const triggerButton = canvas.getByTestId('trigger-button');
|
|
314
|
-
await userEvent.click(triggerButton);
|
|
315
|
-
await waitFor(() => expect(triggerButton).toHaveFocus());
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
// ==========================================
|
|
321
|
-
// 7.4 Visual Tests
|
|
322
|
-
// ==========================================
|
|
323
|
-
|
|
324
|
-
export const ResponsiveDesign: Story = {
|
|
325
|
-
name: '📱 Responsive Design Test',
|
|
326
|
-
args: {
|
|
327
|
-
responsive: true,
|
|
328
|
-
padding: 'lg',
|
|
329
|
-
'data-testid': 'responsive-container',
|
|
330
|
-
children: (
|
|
331
|
-
<Card>
|
|
332
|
-
<CardContent>
|
|
333
|
-
<Typography variant="h6" gutterBottom>
|
|
334
|
-
Responsive Container Content
|
|
335
|
-
</Typography>
|
|
336
|
-
<Typography>
|
|
337
|
-
This content adapts to different screen sizes with responsive padding.
|
|
338
|
-
</Typography>
|
|
339
|
-
</CardContent>
|
|
340
|
-
</Card>
|
|
341
|
-
),
|
|
342
|
-
},
|
|
343
|
-
parameters: {
|
|
344
|
-
viewport: {
|
|
345
|
-
viewports: {
|
|
346
|
-
mobile: {
|
|
347
|
-
name: 'Mobile',
|
|
348
|
-
styles: { width: '375px', height: '667px' },
|
|
349
|
-
type: 'mobile'
|
|
350
|
-
},
|
|
351
|
-
tablet: {
|
|
352
|
-
name: 'Tablet',
|
|
353
|
-
styles: { width: '768px', height: '1024px' },
|
|
354
|
-
type: 'tablet'
|
|
355
|
-
},
|
|
356
|
-
desktop: {
|
|
357
|
-
name: 'Desktop',
|
|
358
|
-
styles: { width: '1920px', height: '1080px' },
|
|
359
|
-
type: 'desktop'
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
defaultViewport: 'mobile'
|
|
363
|
-
},
|
|
364
|
-
chromatic: {
|
|
365
|
-
viewports: [375, 768, 1920],
|
|
366
|
-
delay: 300
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
play: async ({ canvasElement, step }) => {
|
|
370
|
-
const canvas = within(canvasElement);
|
|
371
|
-
|
|
372
|
-
await step('Verify responsive container exists', async () => {
|
|
373
|
-
const container = canvas.getByTestId('responsive-container');
|
|
374
|
-
await expect(container).toBeInTheDocument();
|
|
375
|
-
|
|
376
|
-
// Verify the container has computed styles
|
|
377
|
-
const computedStyle = window.getComputedStyle(container);
|
|
378
|
-
await expect(computedStyle).toBeDefined();
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
await step('Verify content renders properly', async () => {
|
|
382
|
-
const heading = canvas.getByText('Responsive Container Content');
|
|
383
|
-
await expect(heading).toBeInTheDocument();
|
|
384
|
-
|
|
385
|
-
const content = canvas.getByText(/This content adapts to different screen sizes/);
|
|
386
|
-
await expect(content).toBeInTheDocument();
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
export const ThemeVariations: Story = {
|
|
392
|
-
name: '🎨 Theme Variations Test',
|
|
393
|
-
args: {
|
|
394
|
-
'data-testid': 'themed-container',
|
|
395
|
-
sx: {
|
|
396
|
-
backgroundColor: 'background.paper',
|
|
397
|
-
color: 'text.primary',
|
|
398
|
-
border: '1px solid',
|
|
399
|
-
borderColor: 'divider',
|
|
400
|
-
borderRadius: 1,
|
|
401
|
-
},
|
|
402
|
-
children: (
|
|
403
|
-
<Box sx={{ p: 2 }}>
|
|
404
|
-
<Typography variant="h6" gutterBottom>
|
|
405
|
-
Theme-Aware Container
|
|
406
|
-
</Typography>
|
|
407
|
-
<Typography color="text.secondary">
|
|
408
|
-
This container uses theme colors and responds to theme changes.
|
|
409
|
-
</Typography>
|
|
410
|
-
</Box>
|
|
411
|
-
),
|
|
412
|
-
},
|
|
413
|
-
parameters: {
|
|
414
|
-
backgrounds: {
|
|
415
|
-
default: 'light',
|
|
416
|
-
values: [
|
|
417
|
-
{ name: 'light', value: '#ffffff' },
|
|
418
|
-
{ name: 'dark', value: '#1a1a1a' }
|
|
419
|
-
]
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
play: async ({ canvasElement, step }) => {
|
|
423
|
-
const canvas = within(canvasElement);
|
|
424
|
-
|
|
425
|
-
await step('Verify theme colors applied', async () => {
|
|
426
|
-
const container = canvas.getByTestId('themed-container');
|
|
427
|
-
const computedStyle = window.getComputedStyle(container);
|
|
428
|
-
|
|
429
|
-
// Check if background color is applied
|
|
430
|
-
await expect(computedStyle.backgroundColor).toMatch(/rgb/);
|
|
431
|
-
await expect(container).toBeInTheDocument();
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
await step('Verify content visibility', async () => {
|
|
435
|
-
const heading = canvas.getByText('Theme-Aware Container');
|
|
436
|
-
await expect(heading).toBeVisible();
|
|
437
|
-
|
|
438
|
-
const description = canvas.getByText(/This container uses theme colors/);
|
|
439
|
-
await expect(description).toBeVisible();
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
export const VisualStates: Story = {
|
|
445
|
-
name: '👁️ Visual States Test',
|
|
446
|
-
args: {
|
|
447
|
-
'data-testid': 'visual-states-container',
|
|
448
|
-
children: (
|
|
449
|
-
<Box>
|
|
450
|
-
<Paper
|
|
451
|
-
data-testid="default-state"
|
|
452
|
-
sx={{
|
|
453
|
-
p: 2,
|
|
454
|
-
mb: 2,
|
|
455
|
-
opacity: 1,
|
|
456
|
-
transition: 'all 0.3s ease'
|
|
457
|
-
}}
|
|
458
|
-
>
|
|
459
|
-
<Typography>Default State</Typography>
|
|
460
|
-
</Paper>
|
|
461
|
-
|
|
462
|
-
<Paper
|
|
463
|
-
data-testid="hover-state"
|
|
464
|
-
sx={{
|
|
465
|
-
p: 2,
|
|
466
|
-
mb: 2,
|
|
467
|
-
cursor: 'pointer',
|
|
468
|
-
'&:hover': {
|
|
469
|
-
transform: 'scale(1.02)',
|
|
470
|
-
boxShadow: 4
|
|
471
|
-
}
|
|
472
|
-
}}
|
|
473
|
-
>
|
|
474
|
-
<Typography>Hover State (hover me)</Typography>
|
|
475
|
-
</Paper>
|
|
476
|
-
|
|
477
|
-
<Button
|
|
478
|
-
data-testid="active-button"
|
|
479
|
-
variant="contained"
|
|
480
|
-
sx={{ mb: 2 }}
|
|
481
|
-
>
|
|
482
|
-
Active Button
|
|
483
|
-
</Button>
|
|
484
|
-
|
|
485
|
-
<Button
|
|
486
|
-
data-testid="disabled-button"
|
|
487
|
-
variant="outlined"
|
|
488
|
-
disabled
|
|
489
|
-
sx={{ opacity: 0.5 }}
|
|
490
|
-
>
|
|
491
|
-
Disabled Button
|
|
492
|
-
</Button>
|
|
493
|
-
</Box>
|
|
494
|
-
),
|
|
495
|
-
},
|
|
496
|
-
play: async ({ canvasElement, step }) => {
|
|
497
|
-
const canvas = within(canvasElement);
|
|
498
|
-
|
|
499
|
-
await step('Default state verification', async () => {
|
|
500
|
-
const defaultElement = canvas.getByTestId('default-state');
|
|
501
|
-
await expect(defaultElement).toHaveStyle({ opacity: '1' });
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
await step('Hover state interaction', async () => {
|
|
505
|
-
const hoverElement = canvas.getByTestId('hover-state');
|
|
506
|
-
await userEvent.hover(hoverElement);
|
|
507
|
-
|
|
508
|
-
// Element should still be in document after hover
|
|
509
|
-
await expect(hoverElement).toBeInTheDocument();
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
await step('Active state interaction', async () => {
|
|
513
|
-
const activeButton = canvas.getByTestId('active-button');
|
|
514
|
-
await userEvent.click(activeButton);
|
|
515
|
-
await expect(activeButton).toBeInTheDocument();
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
await step('Disabled state verification', async () => {
|
|
519
|
-
const disabledButton = canvas.getByTestId('disabled-button');
|
|
520
|
-
await expect(disabledButton).toBeDisabled();
|
|
521
|
-
await expect(disabledButton).toHaveStyle({ opacity: '0.5' });
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
// ==========================================
|
|
527
|
-
// 7.5 Performance Tests
|
|
528
|
-
// ==========================================
|
|
529
|
-
|
|
530
|
-
export const PerformanceTest: Story = {
|
|
531
|
-
name: '⚡ Performance Test',
|
|
532
|
-
args: {
|
|
533
|
-
'data-testid': 'performance-container',
|
|
534
|
-
children: (
|
|
535
|
-
<Box>
|
|
536
|
-
{Array.from({ length: 100 }, (_, i) => (
|
|
537
|
-
<Paper
|
|
538
|
-
key={i}
|
|
539
|
-
data-testid={`item-${i}`}
|
|
540
|
-
sx={{ p: 1, mb: 1, bgcolor: i % 2 ? 'grey.50' : 'grey.100' }}
|
|
541
|
-
>
|
|
542
|
-
<Typography variant="body2">
|
|
543
|
-
Item {i} - Performance test content
|
|
544
|
-
</Typography>
|
|
545
|
-
</Paper>
|
|
546
|
-
))}
|
|
547
|
-
</Box>
|
|
548
|
-
),
|
|
549
|
-
},
|
|
550
|
-
play: async ({ canvasElement, step }) => {
|
|
551
|
-
const canvas = within(canvasElement);
|
|
552
|
-
|
|
553
|
-
await step('Measure render time', async () => {
|
|
554
|
-
const elements = canvas.getAllByTestId(/item-/);
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// Verify reasonable number of elements rendered
|
|
558
|
-
await expect(elements.length).toBeGreaterThan(50);
|
|
559
|
-
await expect(elements.length).toBeLessThanOrEqual(100);
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
await step('Test container responsiveness', async () => {
|
|
563
|
-
const container = canvas.getByTestId('performance-container');
|
|
564
|
-
await expect(container).toBeInTheDocument();
|
|
565
|
-
|
|
566
|
-
// Test that container handles many child elements gracefully
|
|
567
|
-
const firstItem = canvas.getByTestId('item-0');
|
|
568
|
-
const lastItem = canvas.getByTestId('item-99');
|
|
569
|
-
|
|
570
|
-
await expect(firstItem).toBeInTheDocument();
|
|
571
|
-
await expect(lastItem).toBeInTheDocument();
|
|
572
|
-
});
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
|
|
576
|
-
// ==========================================
|
|
577
|
-
// 7.6 Edge Cases Tests
|
|
578
|
-
// ==========================================
|
|
579
|
-
|
|
580
|
-
export const EdgeCases: Story = {
|
|
581
|
-
name: '🔧 Edge Cases Test',
|
|
582
|
-
args: {
|
|
583
|
-
'data-testid': 'edge-case-container',
|
|
584
|
-
children: (
|
|
585
|
-
<Box>
|
|
586
|
-
<Box data-testid="empty-state" sx={{ mb: 2, p: 2, border: '2px dashed #ccc' }}>
|
|
587
|
-
<Typography variant="body2" color="text.secondary">
|
|
588
|
-
No data available
|
|
589
|
-
</Typography>
|
|
590
|
-
</Box>
|
|
591
|
-
|
|
592
|
-
<Paper sx={{ p: 2, mb: 2 }}>
|
|
593
|
-
<Typography
|
|
594
|
-
data-testid="long-text"
|
|
595
|
-
sx={{
|
|
596
|
-
overflow: 'hidden',
|
|
597
|
-
textOverflow: 'ellipsis',
|
|
598
|
-
whiteSpace: 'nowrap',
|
|
599
|
-
maxWidth: '100%'
|
|
600
|
-
}}
|
|
601
|
-
>
|
|
602
|
-
ThisIsAVeryLongTextThatShouldTestHowTheContainerHandlesOverflowingContentAndWordBreakingInVariousScenarios
|
|
603
|
-
</Typography>
|
|
604
|
-
</Paper>
|
|
605
|
-
|
|
606
|
-
<Paper sx={{ p: 2 }}>
|
|
607
|
-
<input
|
|
608
|
-
data-testid="limited-input"
|
|
609
|
-
type="text"
|
|
610
|
-
maxLength={50}
|
|
611
|
-
placeholder="Max 50 characters"
|
|
612
|
-
style={{ width: '100%', padding: '8px' }}
|
|
613
|
-
/>
|
|
614
|
-
</Paper>
|
|
615
|
-
</Box>
|
|
616
|
-
),
|
|
617
|
-
},
|
|
618
|
-
play: async ({ canvasElement, step }) => {
|
|
619
|
-
const canvas = within(canvasElement);
|
|
620
|
-
|
|
621
|
-
await step('Empty content handling', async () => {
|
|
622
|
-
const emptyState = canvas.getByTestId('empty-state');
|
|
623
|
-
await expect(emptyState).toHaveTextContent(/no data/i);
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
await step('Long text overflow handling', async () => {
|
|
627
|
-
const longText = canvas.getByTestId('long-text');
|
|
628
|
-
const computedStyle = window.getComputedStyle(longText);
|
|
629
|
-
await expect(computedStyle.textOverflow).toBe('ellipsis');
|
|
630
|
-
await expect(longText).toBeInTheDocument();
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
await step('Input limits testing', async () => {
|
|
634
|
-
|
|
635
|
-
const input = canvas.getByTestId('limited-input') as HTMLInputElement;
|
|
636
|
-
const testText = 'a'.repeat(100); // 100 characters
|
|
637
|
-
|
|
638
|
-
await userEvent.clear(input);
|
|
639
|
-
await userEvent.type(input, testText);
|
|
640
|
-
|
|
641
|
-
// Should be limited to maxLength
|
|
642
|
-
await expect(input.value.length).toBeLessThanOrEqual(50);
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
await step('Container structure integrity', async () => {
|
|
646
|
-
const container = canvas.getByTestId('edge-case-container');
|
|
647
|
-
await expect(container).toBeInTheDocument();
|
|
648
|
-
|
|
649
|
-
// Container should handle all edge case content gracefully
|
|
650
|
-
const allChildren = container.querySelectorAll('*');
|
|
651
|
-
await expect(allChildren.length).toBeGreaterThan(0);
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
// ==========================================
|
|
657
|
-
// 7.7 Integration Tests
|
|
658
|
-
// ==========================================
|
|
659
|
-
|
|
660
|
-
export const IntegrationTest: Story = {
|
|
661
|
-
name: '🔗 Integration Test',
|
|
662
|
-
args: {
|
|
663
|
-
'data-testid': 'integration-container',
|
|
664
|
-
variant: 'padded',
|
|
665
|
-
maxWidth: 'md',
|
|
666
|
-
children: (
|
|
667
|
-
<Box>
|
|
668
|
-
<Card data-testid="integrated-card" sx={{ mb: 2 }}>
|
|
669
|
-
<CardContent>
|
|
670
|
-
<Typography variant="h6" gutterBottom>
|
|
671
|
-
Integrated Components
|
|
672
|
-
</Typography>
|
|
673
|
-
<Button
|
|
674
|
-
data-testid="trigger-component"
|
|
675
|
-
variant="contained"
|
|
676
|
-
sx={{ mr: 2 }}
|
|
677
|
-
>
|
|
678
|
-
Trigger Action
|
|
679
|
-
</Button>
|
|
680
|
-
<Button
|
|
681
|
-
data-testid="receiver-component"
|
|
682
|
-
variant="outlined"
|
|
683
|
-
color="success"
|
|
684
|
-
>
|
|
685
|
-
Receiver
|
|
686
|
-
</Button>
|
|
687
|
-
</CardContent>
|
|
688
|
-
</Card>
|
|
689
|
-
|
|
690
|
-
<Paper data-testid="status-display" sx={{ p: 2 }}>
|
|
691
|
-
<Typography
|
|
692
|
-
data-testid="status-text"
|
|
693
|
-
variant="body1"
|
|
694
|
-
>
|
|
695
|
-
Status: Ready
|
|
696
|
-
</Typography>
|
|
697
|
-
</Paper>
|
|
698
|
-
</Box>
|
|
699
|
-
),
|
|
700
|
-
},
|
|
701
|
-
play: async ({ canvasElement, step }) => {
|
|
702
|
-
const canvas = within(canvasElement);
|
|
703
|
-
|
|
704
|
-
await step('Verify integration setup', async () => {
|
|
705
|
-
const container = canvas.getByTestId('integration-container');
|
|
706
|
-
await expect(container).toBeInTheDocument();
|
|
707
|
-
|
|
708
|
-
const card = canvas.getByTestId('integrated-card');
|
|
709
|
-
await expect(card).toBeInTheDocument();
|
|
710
|
-
|
|
711
|
-
const statusDisplay = canvas.getByTestId('status-display');
|
|
712
|
-
await expect(statusDisplay).toBeInTheDocument();
|
|
713
|
-
});
|
|
714
|
-
|
|
715
|
-
await step('Test component communication', async () => {
|
|
716
|
-
const trigger = canvas.getByTestId('trigger-component');
|
|
717
|
-
const receiver = canvas.getByTestId('receiver-component');
|
|
718
|
-
const statusText = canvas.getByTestId('status-text');
|
|
719
|
-
|
|
720
|
-
await expect(trigger).toBeInTheDocument();
|
|
721
|
-
await expect(receiver).toBeInTheDocument();
|
|
722
|
-
await expect(statusText).toHaveTextContent('Status: Ready');
|
|
723
|
-
|
|
724
|
-
// Simulate interaction
|
|
725
|
-
await userEvent.click(trigger);
|
|
726
|
-
|
|
727
|
-
// Verify components still exist after interaction
|
|
728
|
-
await expect(receiver).toBeInTheDocument();
|
|
729
|
-
await expect(statusText).toBeInTheDocument();
|
|
730
|
-
});
|
|
731
|
-
|
|
732
|
-
await step('Verify container constraints', async () => {
|
|
733
|
-
const container = canvas.getByTestId('integration-container');
|
|
734
|
-
|
|
735
|
-
// Container should constrain child components appropriately
|
|
736
|
-
const card = canvas.getByTestId('integrated-card');
|
|
737
|
-
const cardRect = card.getBoundingClientRect();
|
|
738
|
-
const containerRect = container.getBoundingClientRect();
|
|
739
|
-
|
|
740
|
-
// Card should be contained within container bounds
|
|
741
|
-
await expect(cardRect.left).toBeGreaterThanOrEqual(containerRect.left);
|
|
742
|
-
await expect(cardRect.right).toBeLessThanOrEqual(containerRect.right);
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
};
|