@elvora/react-native 1.0.0-rc.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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.cjs +5785 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1253 -0
- package/dist/index.d.ts +1253 -0
- package/dist/index.js +5683 -0
- package/dist/index.js.map +1 -0
- package/package.json +88 -0
- package/src/Accordion.tsx +11 -0
- package/src/Affix.tsx +20 -0
- package/src/Alert.tsx +102 -0
- package/src/Anchor.tsx +58 -0
- package/src/AutoComplete.tsx +122 -0
- package/src/Avatar.tsx +58 -0
- package/src/BackTop.tsx +71 -0
- package/src/Backdrop.tsx +32 -0
- package/src/Badge.tsx +87 -0
- package/src/Box.tsx +67 -0
- package/src/Breadcrumb.tsx +46 -0
- package/src/Button.test.tsx +39 -0
- package/src/Button.tsx +127 -0
- package/src/ButtonGroup.tsx +74 -0
- package/src/Calendar.tsx +165 -0
- package/src/Card.tsx +69 -0
- package/src/Carousel.tsx +99 -0
- package/src/Cascader.tsx +160 -0
- package/src/Checkbox.tsx +85 -0
- package/src/ChipInput.tsx +130 -0
- package/src/Collapse.tsx +120 -0
- package/src/ColorPicker.tsx +114 -0
- package/src/Container.tsx +22 -0
- package/src/DataGrid.tsx +170 -0
- package/src/DatePicker.tsx +195 -0
- package/src/DateRangePicker.tsx +249 -0
- package/src/Descriptions.tsx +98 -0
- package/src/Divider.tsx +32 -0
- package/src/Drawer.tsx +103 -0
- package/src/Dropdown.tsx +15 -0
- package/src/ElvoraProvider.tsx +31 -0
- package/src/Empty.tsx +34 -0
- package/src/FloatButton.tsx +78 -0
- package/src/Form.tsx +119 -0
- package/src/Grid.tsx +68 -0
- package/src/Icon.tsx +49 -0
- package/src/IconButton.tsx +28 -0
- package/src/Image.tsx +68 -0
- package/src/ImageList.tsx +58 -0
- package/src/Input.tsx +87 -0
- package/src/Label.tsx +46 -0
- package/src/List.tsx +82 -0
- package/src/Mentions.tsx +148 -0
- package/src/Menu.tsx +77 -0
- package/src/Modal.tsx +114 -0
- package/src/NumberInput.tsx +156 -0
- package/src/Pagination.tsx +148 -0
- package/src/PaginationVariants.tsx +64 -0
- package/src/Popover.tsx +74 -0
- package/src/ProForm.tsx +219 -0
- package/src/ProLayout.tsx +151 -0
- package/src/ProTable.tsx +91 -0
- package/src/Progress.tsx +92 -0
- package/src/QRCode.tsx +65 -0
- package/src/Radio.tsx +98 -0
- package/src/Rate.tsx +66 -0
- package/src/Result.tsx +64 -0
- package/src/Segmented.tsx +75 -0
- package/src/Select.tsx +146 -0
- package/src/Skeleton.tsx +49 -0
- package/src/Slider.tsx +122 -0
- package/src/SpeedDial.tsx +87 -0
- package/src/Spinner.tsx +29 -0
- package/src/Splitter.tsx +91 -0
- package/src/Stack.tsx +38 -0
- package/src/Statistic.tsx +60 -0
- package/src/Stepper.tsx +113 -0
- package/src/Steps.tsx +146 -0
- package/src/Switch.tsx +52 -0
- package/src/Table.tsx +178 -0
- package/src/Tabs.tsx +122 -0
- package/src/Tag.tsx +83 -0
- package/src/Textarea.tsx +22 -0
- package/src/TimePicker.tsx +187 -0
- package/src/Timeline.tsx +92 -0
- package/src/Toast.tsx +140 -0
- package/src/ToggleButton.tsx +66 -0
- package/src/Tooltip.tsx +56 -0
- package/src/Tour.tsx +118 -0
- package/src/Transfer.tsx +219 -0
- package/src/Tree.tsx +144 -0
- package/src/TreeSelect.tsx +221 -0
- package/src/Upload.tsx +109 -0
- package/src/Watermark.tsx +76 -0
- package/src/index.ts +221 -0
- package/src/smoke.test.tsx +113 -0
- package/src/test/react-native-stub.tsx +413 -0
- package/src/test/react-native-svg-stub.tsx +33 -0
- package/src/test/setup.ts +7 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Text, View, type ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface WatermarkProps extends ViewProps {
|
|
5
|
+
content: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
rotate?: number;
|
|
8
|
+
gapX?: number;
|
|
9
|
+
gapY?: number;
|
|
10
|
+
fontSize?: number;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Watermark — repeats text diagonally across the children. Implemented with a
|
|
16
|
+
* grid of `<Text>` nodes since RN doesn't expose CSS background patterns.
|
|
17
|
+
*/
|
|
18
|
+
export function Watermark(props: WatermarkProps) {
|
|
19
|
+
const {
|
|
20
|
+
content,
|
|
21
|
+
color = 'rgba(0,0,0,0.15)',
|
|
22
|
+
rotate = -22,
|
|
23
|
+
gapX = 140,
|
|
24
|
+
gapY = 100,
|
|
25
|
+
fontSize = 14,
|
|
26
|
+
children,
|
|
27
|
+
style,
|
|
28
|
+
...rest
|
|
29
|
+
} = props;
|
|
30
|
+
const rows = 12;
|
|
31
|
+
const cols = 6;
|
|
32
|
+
return (
|
|
33
|
+
<View style={[{ position: 'relative', overflow: 'hidden' }, style]} {...rest}>
|
|
34
|
+
{children}
|
|
35
|
+
<View
|
|
36
|
+
pointerEvents="none"
|
|
37
|
+
style={{
|
|
38
|
+
position: 'absolute',
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
right: 0,
|
|
42
|
+
bottom: 0,
|
|
43
|
+
opacity: 0.7,
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
{Array.from({ length: rows }).map((_, ri) => (
|
|
47
|
+
<View
|
|
48
|
+
key={ri}
|
|
49
|
+
style={{
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: ri * gapY,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{Array.from({ length: cols }).map((__, ci) => (
|
|
58
|
+
<Text
|
|
59
|
+
key={ci}
|
|
60
|
+
style={{
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
left: ci * gapX + (ri % 2 ? gapX / 2 : 0),
|
|
63
|
+
color,
|
|
64
|
+
fontSize,
|
|
65
|
+
transform: [{ rotate: `${rotate}deg` }],
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{content}
|
|
69
|
+
</Text>
|
|
70
|
+
))}
|
|
71
|
+
</View>
|
|
72
|
+
))}
|
|
73
|
+
</View>
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export { ElvoraProvider, useTheme, useElvoraContext } from './ElvoraProvider';
|
|
2
|
+
export type { ElvoraProviderProps } from './ElvoraProvider';
|
|
3
|
+
|
|
4
|
+
export { Button } from './Button';
|
|
5
|
+
export type { ButtonProps } from './Button';
|
|
6
|
+
|
|
7
|
+
export { IconButton } from './IconButton';
|
|
8
|
+
export type { IconButtonProps } from './IconButton';
|
|
9
|
+
|
|
10
|
+
export { Input } from './Input';
|
|
11
|
+
export type { InputProps } from './Input';
|
|
12
|
+
|
|
13
|
+
export { Textarea } from './Textarea';
|
|
14
|
+
export type { TextareaProps } from './Textarea';
|
|
15
|
+
|
|
16
|
+
export { Checkbox } from './Checkbox';
|
|
17
|
+
export type { CheckboxProps } from './Checkbox';
|
|
18
|
+
|
|
19
|
+
export { Radio, RadioGroup } from './Radio';
|
|
20
|
+
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
21
|
+
|
|
22
|
+
export { Switch } from './Switch';
|
|
23
|
+
export type { SwitchProps } from './Switch';
|
|
24
|
+
|
|
25
|
+
export { Select } from './Select';
|
|
26
|
+
export type { SelectProps, SelectOption } from './Select';
|
|
27
|
+
|
|
28
|
+
export { Label } from './Label';
|
|
29
|
+
export type { LabelProps } from './Label';
|
|
30
|
+
|
|
31
|
+
export { Icon } from './Icon';
|
|
32
|
+
export type { IconProps } from './Icon';
|
|
33
|
+
|
|
34
|
+
export { Divider } from './Divider';
|
|
35
|
+
export type { DividerProps } from './Divider';
|
|
36
|
+
|
|
37
|
+
export { Avatar } from './Avatar';
|
|
38
|
+
export type { AvatarProps } from './Avatar';
|
|
39
|
+
|
|
40
|
+
export { Badge } from './Badge';
|
|
41
|
+
export type { BadgeProps } from './Badge';
|
|
42
|
+
|
|
43
|
+
export { Tag } from './Tag';
|
|
44
|
+
export type { TagProps } from './Tag';
|
|
45
|
+
|
|
46
|
+
export { Spinner } from './Spinner';
|
|
47
|
+
export type { SpinnerProps } from './Spinner';
|
|
48
|
+
|
|
49
|
+
export { Progress } from './Progress';
|
|
50
|
+
export type { ProgressProps } from './Progress';
|
|
51
|
+
|
|
52
|
+
export { Tooltip } from './Tooltip';
|
|
53
|
+
export type { TooltipProps } from './Tooltip';
|
|
54
|
+
|
|
55
|
+
// Phase 2 — Layout
|
|
56
|
+
export { Box } from './Box';
|
|
57
|
+
export type { BoxProps } from './Box';
|
|
58
|
+
export { Stack, HStack, VStack } from './Stack';
|
|
59
|
+
export type { StackProps } from './Stack';
|
|
60
|
+
export { Grid, GridItem } from './Grid';
|
|
61
|
+
export type { GridProps, GridItemProps } from './Grid';
|
|
62
|
+
export { Container } from './Container';
|
|
63
|
+
export type { ContainerProps } from './Container';
|
|
64
|
+
export { Card, CardHeader, CardBody, CardFooter } from './Card';
|
|
65
|
+
export type { CardProps } from './Card';
|
|
66
|
+
|
|
67
|
+
// Phase 2 — Feedback
|
|
68
|
+
export { Alert } from './Alert';
|
|
69
|
+
export type { AlertProps } from './Alert';
|
|
70
|
+
export { Skeleton } from './Skeleton';
|
|
71
|
+
export type { SkeletonProps } from './Skeleton';
|
|
72
|
+
export { Empty } from './Empty';
|
|
73
|
+
export type { EmptyProps } from './Empty';
|
|
74
|
+
export { Result } from './Result';
|
|
75
|
+
export type { ResultProps, ResultStatus } from './Result';
|
|
76
|
+
|
|
77
|
+
// Phase 2 — Overlays
|
|
78
|
+
export { Modal } from './Modal';
|
|
79
|
+
export type { ModalProps } from './Modal';
|
|
80
|
+
export { Drawer } from './Drawer';
|
|
81
|
+
export type { DrawerProps } from './Drawer';
|
|
82
|
+
export { Popover } from './Popover';
|
|
83
|
+
export type { PopoverProps } from './Popover';
|
|
84
|
+
export { ToastProvider, useToast } from './Toast';
|
|
85
|
+
export type { ToastProviderProps, ToastApi, ToastOptions } from './Toast';
|
|
86
|
+
|
|
87
|
+
// Phase 3 — Navigation
|
|
88
|
+
export { Tabs } from './Tabs';
|
|
89
|
+
export type { TabsProps, TabsTab } from './Tabs';
|
|
90
|
+
export { Menu } from './Menu';
|
|
91
|
+
export type { MenuProps, MenuItem } from './Menu';
|
|
92
|
+
export { Dropdown } from './Dropdown';
|
|
93
|
+
export type { DropdownProps, DropdownItem } from './Dropdown';
|
|
94
|
+
export { Breadcrumb } from './Breadcrumb';
|
|
95
|
+
export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb';
|
|
96
|
+
export { Pagination } from './Pagination';
|
|
97
|
+
export type { PaginationProps } from './Pagination';
|
|
98
|
+
export { Steps } from './Steps';
|
|
99
|
+
export type { StepsProps, Step } from './Steps';
|
|
100
|
+
export { Anchor } from './Anchor';
|
|
101
|
+
export type { AnchorProps, AnchorLink } from './Anchor';
|
|
102
|
+
export { BackTop } from './BackTop';
|
|
103
|
+
export type { BackTopProps } from './BackTop';
|
|
104
|
+
|
|
105
|
+
// Phase 4 — Data Entry
|
|
106
|
+
export { Form, FormField, useFormField } from './Form';
|
|
107
|
+
export type { FormProps, FormFieldProps } from './Form';
|
|
108
|
+
export { NumberInput } from './NumberInput';
|
|
109
|
+
export type { NumberInputProps } from './NumberInput';
|
|
110
|
+
export { Segmented } from './Segmented';
|
|
111
|
+
export type { SegmentedProps, SegmentedOption } from './Segmented';
|
|
112
|
+
export { Slider } from './Slider';
|
|
113
|
+
export type { SliderProps } from './Slider';
|
|
114
|
+
export { Rate } from './Rate';
|
|
115
|
+
export type { RateProps } from './Rate';
|
|
116
|
+
export { Upload, makeUploadFile } from './Upload';
|
|
117
|
+
export type { UploadProps, UploadFile } from './Upload';
|
|
118
|
+
export { AutoComplete } from './AutoComplete';
|
|
119
|
+
export type { AutoCompleteProps, AutoCompleteOption } from './AutoComplete';
|
|
120
|
+
export { ColorPicker } from './ColorPicker';
|
|
121
|
+
export type { ColorPickerProps } from './ColorPicker';
|
|
122
|
+
export { DatePicker } from './DatePicker';
|
|
123
|
+
export type { DatePickerProps, DateValue } from './DatePicker';
|
|
124
|
+
export { TimePicker } from './TimePicker';
|
|
125
|
+
export type { TimePickerProps, TimeValue } from './TimePicker';
|
|
126
|
+
export { DateRangePicker } from './DateRangePicker';
|
|
127
|
+
export type { DateRangePickerProps, DateRange } from './DateRangePicker';
|
|
128
|
+
export { Cascader } from './Cascader';
|
|
129
|
+
export type { CascaderProps, CascaderOption } from './Cascader';
|
|
130
|
+
export { TreeSelect } from './TreeSelect';
|
|
131
|
+
export type { TreeSelectProps, TreeNode } from './TreeSelect';
|
|
132
|
+
export { Mentions } from './Mentions';
|
|
133
|
+
export type { MentionsProps, MentionItem } from './Mentions';
|
|
134
|
+
export { Transfer } from './Transfer';
|
|
135
|
+
export type { TransferProps, TransferItem } from './Transfer';
|
|
136
|
+
|
|
137
|
+
// Phase 5 — Data Display
|
|
138
|
+
export { Table } from './Table';
|
|
139
|
+
export type { TableProps, TableColumn, SortOrder } from './Table';
|
|
140
|
+
export { Tree } from './Tree';
|
|
141
|
+
export type { TreeProps, TreeNode as TreeDataNode } from './Tree';
|
|
142
|
+
export { List } from './List';
|
|
143
|
+
export type { ListProps } from './List';
|
|
144
|
+
export { Descriptions } from './Descriptions';
|
|
145
|
+
export type { DescriptionsProps, DescriptionItem } from './Descriptions';
|
|
146
|
+
export { Calendar } from './Calendar';
|
|
147
|
+
export type { CalendarProps } from './Calendar';
|
|
148
|
+
export { Statistic } from './Statistic';
|
|
149
|
+
export type { StatisticProps } from './Statistic';
|
|
150
|
+
export { Carousel } from './Carousel';
|
|
151
|
+
export type { CarouselProps } from './Carousel';
|
|
152
|
+
export { Image } from './Image';
|
|
153
|
+
export type { ImageProps } from './Image';
|
|
154
|
+
export { Timeline } from './Timeline';
|
|
155
|
+
export type { TimelineProps, TimelineItem, TimelineItemStatus } from './Timeline';
|
|
156
|
+
export { Collapse } from './Collapse';
|
|
157
|
+
export type { CollapseProps, CollapseItem } from './Collapse';
|
|
158
|
+
export { Accordion } from './Accordion';
|
|
159
|
+
export type { AccordionProps, AccordionItem } from './Accordion';
|
|
160
|
+
export { Tour } from './Tour';
|
|
161
|
+
export type { TourProps, TourStep } from './Tour';
|
|
162
|
+
|
|
163
|
+
// Phase 6 — Advanced & MUI extras
|
|
164
|
+
export { FloatButton } from './FloatButton';
|
|
165
|
+
export type { FloatButtonProps } from './FloatButton';
|
|
166
|
+
export { Watermark } from './Watermark';
|
|
167
|
+
export type { WatermarkProps } from './Watermark';
|
|
168
|
+
export { QRCode } from './QRCode';
|
|
169
|
+
export type { QRCodeProps } from './QRCode';
|
|
170
|
+
export { Splitter } from './Splitter';
|
|
171
|
+
export type { SplitterProps } from './Splitter';
|
|
172
|
+
export { Affix } from './Affix';
|
|
173
|
+
export type { AffixProps } from './Affix';
|
|
174
|
+
export { SpeedDial } from './SpeedDial';
|
|
175
|
+
export type { SpeedDialProps, SpeedDialAction } from './SpeedDial';
|
|
176
|
+
export { Backdrop } from './Backdrop';
|
|
177
|
+
export type { BackdropProps } from './Backdrop';
|
|
178
|
+
export { ImageList } from './ImageList';
|
|
179
|
+
export type { ImageListProps, ImageListItem } from './ImageList';
|
|
180
|
+
export { SimplePagination, MiniPagination } from './PaginationVariants';
|
|
181
|
+
export type { SimplePaginationProps, MiniPaginationProps } from './PaginationVariants';
|
|
182
|
+
export { Stepper } from './Stepper';
|
|
183
|
+
export type { StepperProps, StepperStep } from './Stepper';
|
|
184
|
+
export { ToggleButton } from './ToggleButton';
|
|
185
|
+
export type { ToggleButtonProps } from './ToggleButton';
|
|
186
|
+
export { ButtonGroup } from './ButtonGroup';
|
|
187
|
+
export type {
|
|
188
|
+
ButtonGroupProps,
|
|
189
|
+
ButtonGroupOrientation,
|
|
190
|
+
ButtonGroupSelectionMode,
|
|
191
|
+
} from './ButtonGroup';
|
|
192
|
+
export { ChipInput } from './ChipInput';
|
|
193
|
+
export type { ChipInputProps } from './ChipInput';
|
|
194
|
+
|
|
195
|
+
// Phase 7 — Pro / DataGrid
|
|
196
|
+
export { ProTable } from './ProTable';
|
|
197
|
+
export type { ProTableProps, ProTableColumn, ProTableToolbar } from './ProTable';
|
|
198
|
+
export { ProForm } from './ProForm';
|
|
199
|
+
export type {
|
|
200
|
+
ProFormProps,
|
|
201
|
+
ProFormField,
|
|
202
|
+
ProFormFieldType,
|
|
203
|
+
ProFormSelectOption,
|
|
204
|
+
} from './ProForm';
|
|
205
|
+
export { ProLayout } from './ProLayout';
|
|
206
|
+
export type { ProLayoutProps, ProLayoutMenuItem, ProLayoutUser } from './ProLayout';
|
|
207
|
+
export { DataGrid } from './DataGrid';
|
|
208
|
+
export type { DataGridProps, DataGridColumn, DataGridSortOrder } from './DataGrid';
|
|
209
|
+
|
|
210
|
+
export type {
|
|
211
|
+
ElvoraTheme,
|
|
212
|
+
ThemeColors,
|
|
213
|
+
IntentScale,
|
|
214
|
+
ElvoraSize,
|
|
215
|
+
ElvoraVariant,
|
|
216
|
+
ElvoraStatus,
|
|
217
|
+
ElvoraTone,
|
|
218
|
+
Direction,
|
|
219
|
+
Placement,
|
|
220
|
+
Orientation,
|
|
221
|
+
} from '@elvora/core';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { ElvoraProvider } from './ElvoraProvider';
|
|
5
|
+
|
|
6
|
+
import { Input } from './Input';
|
|
7
|
+
import { Textarea } from './Textarea';
|
|
8
|
+
import { Checkbox } from './Checkbox';
|
|
9
|
+
import { Switch } from './Switch';
|
|
10
|
+
import { Badge } from './Badge';
|
|
11
|
+
import { Tag } from './Tag';
|
|
12
|
+
import { Spinner } from './Spinner';
|
|
13
|
+
import { Progress } from './Progress';
|
|
14
|
+
import { Alert } from './Alert';
|
|
15
|
+
import { Card, CardBody, CardHeader } from './Card';
|
|
16
|
+
import { Empty } from './Empty';
|
|
17
|
+
import { Stack } from './Stack';
|
|
18
|
+
import { Box } from './Box';
|
|
19
|
+
import { Divider } from './Divider';
|
|
20
|
+
import { Avatar } from './Avatar';
|
|
21
|
+
|
|
22
|
+
function wrap(node: ReactNode) {
|
|
23
|
+
return render(<ElvoraProvider>{node}</ElvoraProvider>);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('RN smoke — primitives render under the stub', () => {
|
|
27
|
+
it('Input emits onChangeText', () => {
|
|
28
|
+
const onChangeText = vi.fn();
|
|
29
|
+
wrap(<Input value="" onChangeText={onChangeText} placeholder="search" />);
|
|
30
|
+
fireEvent.change(screen.getByPlaceholderText('search'), { target: { value: 'hi' } });
|
|
31
|
+
expect(onChangeText).toHaveBeenCalledWith('hi');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('Textarea renders a multiline placeholder', () => {
|
|
35
|
+
wrap(<Textarea value="" placeholder="bio" />);
|
|
36
|
+
expect(screen.getByPlaceholderText('bio')).toBeInTheDocument();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('Checkbox toggles on click', () => {
|
|
40
|
+
const onChange = vi.fn();
|
|
41
|
+
wrap(<Checkbox isChecked={false} onChange={onChange}>Accept</Checkbox>);
|
|
42
|
+
fireEvent.click(screen.getByRole('checkbox'));
|
|
43
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('Switch exposes role=switch', () => {
|
|
47
|
+
wrap(<Switch isChecked />);
|
|
48
|
+
expect(screen.getAllByRole('switch').length).toBeGreaterThan(0);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('Badge renders its label', () => {
|
|
52
|
+
wrap(<Badge>3</Badge>);
|
|
53
|
+
expect(screen.getByText('3')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('Tag renders its label', () => {
|
|
57
|
+
wrap(<Tag>beta</Tag>);
|
|
58
|
+
expect(screen.getByText('beta')).toBeInTheDocument();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('Spinner renders a progressbar', () => {
|
|
62
|
+
wrap(<Spinner />);
|
|
63
|
+
expect(screen.getAllByRole('progressbar').length).toBeGreaterThan(0);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('Progress renders a progressbar', () => {
|
|
67
|
+
wrap(<Progress value={50} />);
|
|
68
|
+
expect(screen.getAllByRole('progressbar').length).toBeGreaterThan(0);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('Alert renders title and description', () => {
|
|
72
|
+
wrap(<Alert status="info" title="FYI">Body</Alert>);
|
|
73
|
+
expect(screen.getByText('FYI')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByText('Body')).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('Card composes header/body', () => {
|
|
78
|
+
wrap(
|
|
79
|
+
<Card>
|
|
80
|
+
<CardHeader>Title</CardHeader>
|
|
81
|
+
<CardBody>Body</CardBody>
|
|
82
|
+
</Card>,
|
|
83
|
+
);
|
|
84
|
+
expect(screen.getByText('Title')).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByText('Body')).toBeInTheDocument();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('Empty renders a default title', () => {
|
|
89
|
+
wrap(<Empty />);
|
|
90
|
+
expect(screen.getByText(/No data/i)).toBeInTheDocument();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('Stack lays out children', () => {
|
|
94
|
+
wrap(
|
|
95
|
+
<Stack>
|
|
96
|
+
<Box><Badge>A</Badge></Box>
|
|
97
|
+
<Box><Badge>B</Badge></Box>
|
|
98
|
+
</Stack>,
|
|
99
|
+
);
|
|
100
|
+
expect(screen.getByText('A')).toBeInTheDocument();
|
|
101
|
+
expect(screen.getByText('B')).toBeInTheDocument();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('Divider renders without crashing', () => {
|
|
105
|
+
const { container } = wrap(<Divider />);
|
|
106
|
+
expect(container.firstChild).not.toBeNull();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('Avatar renders initials when no src is given', () => {
|
|
110
|
+
wrap(<Avatar name="Ada Lovelace" />);
|
|
111
|
+
expect(screen.getByText(/AL/i)).toBeInTheDocument();
|
|
112
|
+
});
|
|
113
|
+
});
|