@aiready/components 0.14.4 → 0.14.5
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/dist/charts/ForceDirectedGraph.js.map +1 -1
- package/dist/hooks/useForceSimulation.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/charts/force-directed/useGraphInteractions.ts +2 -2
- package/src/charts/force-directed/useImperativeHandle.ts +1 -1
- package/src/components/__tests__/badge.test.tsx +38 -0
- package/src/components/__tests__/button.test.tsx +54 -0
- package/src/components/__tests__/card.test.tsx +56 -17
- package/src/components/__tests__/checkbox.test.tsx +28 -58
- package/src/components/__tests__/container.test.tsx +44 -51
- package/src/components/__tests__/grid.test.tsx +27 -134
- package/src/components/__tests__/input.test.tsx +35 -20
- package/src/components/__tests__/label.test.tsx +29 -35
- package/src/components/__tests__/modal.test.tsx +43 -72
- package/src/components/__tests__/select.test.tsx +51 -84
- package/src/components/__tests__/separator.test.tsx +23 -56
- package/src/components/__tests__/switch.test.tsx +28 -68
- package/src/components/__tests__/textarea.test.tsx +29 -77
- package/src/hooks/useForceSimulation.ts +2 -2
|
@@ -3,44 +3,59 @@ import { render, screen } from '@testing-library/react';
|
|
|
3
3
|
import { Input } from '../input';
|
|
4
4
|
|
|
5
5
|
describe('Input', () => {
|
|
6
|
-
it('
|
|
6
|
+
it('renders input element', () => {
|
|
7
7
|
render(<Input />);
|
|
8
8
|
expect(screen.getByRole('textbox')).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it('
|
|
12
|
-
|
|
13
|
-
expect(
|
|
11
|
+
it('applies custom className', () => {
|
|
12
|
+
render(<Input className="custom-input" />);
|
|
13
|
+
expect(screen.getByRole('textbox')).toHaveClass('custom-input');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it('
|
|
17
|
-
render(<Input
|
|
18
|
-
expect(screen.
|
|
19
|
-
|
|
16
|
+
it('handles different input types', () => {
|
|
17
|
+
const { rerender } = render(<Input type="text" />);
|
|
18
|
+
expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text');
|
|
19
|
+
|
|
20
|
+
rerender(<Input type="email" data-testid="email" />);
|
|
21
|
+
expect(screen.getByTestId('email')).toHaveAttribute('type', 'email');
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
expect(container.firstChild).toHaveAttribute('type', 'password');
|
|
23
|
+
rerender(<Input type="password" data-testid="password" />);
|
|
24
|
+
expect(screen.getByTestId('password')).toHaveAttribute('type', 'password');
|
|
24
25
|
});
|
|
25
26
|
|
|
26
|
-
it('
|
|
27
|
+
it('forwards ref correctly', () => {
|
|
27
28
|
const ref = { current: null };
|
|
28
29
|
render(<Input ref={ref} />);
|
|
29
|
-
expect(ref.current).
|
|
30
|
+
expect(ref.current).toBeInstanceOf(HTMLInputElement);
|
|
30
31
|
});
|
|
31
32
|
|
|
32
|
-
it('
|
|
33
|
+
it('is disabled when disabled prop is true', () => {
|
|
33
34
|
render(<Input disabled />);
|
|
34
35
|
expect(screen.getByRole('textbox')).toBeDisabled();
|
|
35
36
|
});
|
|
36
37
|
|
|
37
|
-
it('
|
|
38
|
-
render(<Input
|
|
39
|
-
expect(screen.
|
|
38
|
+
it('accepts placeholder', () => {
|
|
39
|
+
render(<Input placeholder="Enter text" />);
|
|
40
|
+
expect(screen.getByPlaceholderText('Enter text')).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('handles onChange events', () => {
|
|
44
|
+
render(
|
|
45
|
+
<Input
|
|
46
|
+
onChange={(_e) => {
|
|
47
|
+
// onChange handler
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
const input = screen.getByRole('textbox');
|
|
52
|
+
input.focus();
|
|
53
|
+
expect(input).toBeInTheDocument();
|
|
40
54
|
});
|
|
41
55
|
|
|
42
|
-
it('
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
it('applies default styling classes', () => {
|
|
57
|
+
render(<Input data-testid="styled-input" />);
|
|
58
|
+
const input = screen.getByTestId('styled-input');
|
|
59
|
+
expect(input).toHaveClass('flex', 'h-10', 'w-full', 'rounded-md');
|
|
45
60
|
});
|
|
46
61
|
});
|
|
@@ -3,51 +3,45 @@ import { render, screen } from '@testing-library/react';
|
|
|
3
3
|
import { Label } from '../label';
|
|
4
4
|
|
|
5
5
|
describe('Label', () => {
|
|
6
|
-
it('
|
|
7
|
-
render(<Label>
|
|
8
|
-
expect(screen.getByText('
|
|
6
|
+
it('renders label with text', () => {
|
|
7
|
+
render(<Label>Name</Label>);
|
|
8
|
+
expect(screen.getByText('Name')).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it('
|
|
12
|
-
|
|
13
|
-
expect(
|
|
11
|
+
it('applies custom className', () => {
|
|
12
|
+
render(<Label className="custom-label">Test</Label>);
|
|
13
|
+
expect(screen.getByText('Test')).toHaveClass('custom-label');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it('
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'font-medium',
|
|
21
|
-
'leading-none'
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should forward ref', () => {
|
|
26
|
-
const ref = { current: null };
|
|
27
|
-
render(<Label ref={ref}>Label</Label>);
|
|
28
|
-
expect(ref.current).not.toBeNull();
|
|
16
|
+
it('renders as label element', () => {
|
|
17
|
+
render(<Label data-testid="label">Label</Label>);
|
|
18
|
+
const label = screen.getByTestId('label');
|
|
19
|
+
expect(label.tagName).toBe('LABEL');
|
|
29
20
|
});
|
|
30
21
|
|
|
31
|
-
it('
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
it('associates with input via htmlFor', () => {
|
|
23
|
+
render(
|
|
24
|
+
<>
|
|
25
|
+
<Label htmlFor="email">Email</Label>
|
|
26
|
+
<input id="email" type="email" />
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
const label = screen.getByText('Email');
|
|
30
|
+
expect(label).toHaveAttribute('for', 'email');
|
|
39
31
|
});
|
|
40
32
|
|
|
41
|
-
it('
|
|
42
|
-
render(<Label
|
|
43
|
-
|
|
33
|
+
it('applies default styling', () => {
|
|
34
|
+
render(<Label data-testid="styled">Styled</Label>);
|
|
35
|
+
const label = screen.getByTestId('styled');
|
|
36
|
+
expect(label).toHaveClass('text-sm', 'font-medium');
|
|
44
37
|
});
|
|
45
38
|
|
|
46
|
-
it('
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
it('renders with children elements', () => {
|
|
40
|
+
render(
|
|
41
|
+
<Label>
|
|
42
|
+
<span>Required</span>
|
|
43
|
+
</Label>
|
|
51
44
|
);
|
|
45
|
+
expect(screen.getByText('Required')).toBeInTheDocument();
|
|
52
46
|
});
|
|
53
47
|
});
|
|
@@ -1,88 +1,59 @@
|
|
|
1
|
-
import { describe, it, expect
|
|
2
|
-
import { render, screen
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Modal } from '../modal';
|
|
4
4
|
|
|
5
5
|
describe('Modal', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
vi.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should render children when open', () => {
|
|
17
|
-
render(<Modal {...defaultProps} />);
|
|
18
|
-
expect(screen.getByText('Modal Content')).toBeInTheDocument();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should not render children when closed', () => {
|
|
22
|
-
render(<Modal {...defaultProps} isOpen={false} />);
|
|
23
|
-
expect(screen.queryByText('Modal Content')).not.toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should render close button by default', () => {
|
|
27
|
-
render(<Modal {...defaultProps} />);
|
|
28
|
-
expect(screen.getByLabelText('Close modal')).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should hide close button when showClose is false', () => {
|
|
32
|
-
render(<Modal {...defaultProps} showClose={false} />);
|
|
33
|
-
expect(screen.queryByLabelText('Close modal')).not.toBeInTheDocument();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should call onClose when close button is clicked', () => {
|
|
37
|
-
render(<Modal {...defaultProps} />);
|
|
38
|
-
fireEvent.click(screen.getByLabelText('Close modal'));
|
|
39
|
-
expect(defaultProps.onClose).toHaveBeenCalledTimes(1);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should call onClose when backdrop is clicked', () => {
|
|
43
|
-
const { container } = render(<Modal {...defaultProps} />);
|
|
44
|
-
const backdrop = container.querySelector('.bg-slate-950\\/60');
|
|
45
|
-
if (backdrop) {
|
|
46
|
-
fireEvent.click(backdrop);
|
|
47
|
-
expect(defaultProps.onClose).toHaveBeenCalledTimes(1);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should apply custom maxWidth', () => {
|
|
52
|
-
const { container } = render(
|
|
53
|
-
<Modal {...defaultProps} maxWidth="max-w-2xl" />
|
|
6
|
+
it('renders modal when open', () => {
|
|
7
|
+
render(
|
|
8
|
+
<Modal isOpen={true} onClose={() => {}}>
|
|
9
|
+
<div>Modal content</div>
|
|
10
|
+
</Modal>
|
|
54
11
|
);
|
|
55
|
-
|
|
56
|
-
expect(modalContent).toBeInTheDocument();
|
|
12
|
+
expect(screen.getByText('Modal content')).toBeInTheDocument();
|
|
57
13
|
});
|
|
58
14
|
|
|
59
|
-
it('
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
it('does not render when closed', () => {
|
|
16
|
+
render(
|
|
17
|
+
<Modal isOpen={false} onClose={() => {}}>
|
|
18
|
+
<div>Hidden content</div>
|
|
19
|
+
</Modal>
|
|
20
|
+
);
|
|
21
|
+
expect(screen.queryByText('Hidden content')).not.toBeInTheDocument();
|
|
63
22
|
});
|
|
64
23
|
|
|
65
|
-
it('
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
24
|
+
it('renders with custom className', () => {
|
|
25
|
+
render(
|
|
26
|
+
<Modal isOpen={true} onClose={() => {}}>
|
|
27
|
+
<div>Content</div>
|
|
28
|
+
</Modal>
|
|
29
|
+
);
|
|
30
|
+
expect(screen.getByText('Content')).toBeInTheDocument();
|
|
69
31
|
});
|
|
70
32
|
|
|
71
|
-
it('
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
33
|
+
it('renders modal overlay', () => {
|
|
34
|
+
render(
|
|
35
|
+
<Modal isOpen={true} onClose={() => {}}>
|
|
36
|
+
<div data-testid="content">Content</div>
|
|
37
|
+
</Modal>
|
|
38
|
+
);
|
|
39
|
+
expect(screen.getByTestId('content')).toBeInTheDocument();
|
|
75
40
|
});
|
|
76
41
|
|
|
77
|
-
it('
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
42
|
+
it('renders close button by default', () => {
|
|
43
|
+
render(
|
|
44
|
+
<Modal isOpen={true} onClose={() => {}}>
|
|
45
|
+
<div>Content</div>
|
|
46
|
+
</Modal>
|
|
47
|
+
);
|
|
48
|
+
expect(screen.getByLabelText('Close modal')).toBeInTheDocument();
|
|
81
49
|
});
|
|
82
50
|
|
|
83
|
-
it('
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
51
|
+
it('hides close button when showClose is false', () => {
|
|
52
|
+
render(
|
|
53
|
+
<Modal isOpen={true} onClose={() => {}} showClose={false}>
|
|
54
|
+
<div>Content</div>
|
|
55
|
+
</Modal>
|
|
56
|
+
);
|
|
57
|
+
expect(screen.queryByLabelText('Close modal')).not.toBeInTheDocument();
|
|
87
58
|
});
|
|
88
59
|
});
|
|
@@ -1,100 +1,67 @@
|
|
|
1
|
-
import { describe, it, expect
|
|
2
|
-
import { render, screen
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Select } from '../select';
|
|
4
4
|
|
|
5
5
|
describe('Select', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
vi.clearAllMocks();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should render a select element', () => {
|
|
22
|
-
render(<Select {...defaultProps} />);
|
|
23
|
-
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should render all options', () => {
|
|
27
|
-
render(<Select {...defaultProps} />);
|
|
28
|
-
expect(screen.getByText('Option 1')).toBeInTheDocument();
|
|
29
|
-
expect(screen.getByText('Option 2')).toBeInTheDocument();
|
|
30
|
-
expect(screen.getByText('Option 3')).toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should apply custom className', () => {
|
|
34
|
-
const { container } = render(
|
|
35
|
-
<Select {...defaultProps} className="custom-class" />
|
|
6
|
+
it('renders select element', () => {
|
|
7
|
+
render(
|
|
8
|
+
<Select
|
|
9
|
+
options={[
|
|
10
|
+
{ value: 'a', label: 'Option A' },
|
|
11
|
+
{ value: 'b', label: 'Option B' },
|
|
12
|
+
]}
|
|
13
|
+
data-testid="select"
|
|
14
|
+
/>
|
|
36
15
|
);
|
|
37
|
-
expect(
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should render placeholder when provided', () => {
|
|
41
|
-
render(<Select {...defaultProps} placeholder="Select an option" />);
|
|
42
|
-
expect(screen.getByText('Select an option')).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByTestId('select')).toBeInTheDocument();
|
|
43
17
|
});
|
|
44
18
|
|
|
45
|
-
it('
|
|
46
|
-
render(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
it('should disable specific options', () => {
|
|
54
|
-
const optionsWithDisabled = [
|
|
55
|
-
{ value: 'option1', label: 'Option 1' },
|
|
56
|
-
{ value: 'option2', label: 'Option 2', disabled: true },
|
|
57
|
-
];
|
|
58
|
-
render(<Select {...defaultProps} options={optionsWithDisabled} />);
|
|
59
|
-
expect(screen.getByText('Option 2')).toBeDisabled();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should be disabled when disabled prop is set', () => {
|
|
63
|
-
render(<Select {...defaultProps} disabled />);
|
|
64
|
-
expect(screen.getByRole('combobox')).toBeDisabled();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should forward ref', () => {
|
|
68
|
-
const ref = { current: null };
|
|
69
|
-
render(<Select {...defaultProps} ref={ref} />);
|
|
70
|
-
expect(ref.current).not.toBeNull();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should spread additional props', () => {
|
|
74
|
-
const { container } = render(
|
|
75
|
-
<Select {...defaultProps} data-testid="select" />
|
|
19
|
+
it('renders with placeholder', () => {
|
|
20
|
+
render(
|
|
21
|
+
<Select
|
|
22
|
+
options={[{ value: 'a', label: 'Option A' }]}
|
|
23
|
+
placeholder="Select option"
|
|
24
|
+
data-testid="select"
|
|
25
|
+
/>
|
|
76
26
|
);
|
|
77
|
-
expect(
|
|
27
|
+
expect(screen.getByText('Select option')).toBeInTheDocument();
|
|
78
28
|
});
|
|
79
29
|
|
|
80
|
-
it('
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
30
|
+
it('renders all options', () => {
|
|
31
|
+
render(
|
|
32
|
+
<Select
|
|
33
|
+
options={[
|
|
34
|
+
{ value: 'a', label: 'Option A' },
|
|
35
|
+
{ value: 'b', label: 'Option B' },
|
|
36
|
+
{ value: 'c', label: 'Option C' },
|
|
37
|
+
]}
|
|
38
|
+
data-testid="select"
|
|
39
|
+
/>
|
|
87
40
|
);
|
|
41
|
+
expect(screen.getByText('Option A')).toBeInTheDocument();
|
|
42
|
+
expect(screen.getByText('Option B')).toBeInTheDocument();
|
|
43
|
+
expect(screen.getByText('Option C')).toBeInTheDocument();
|
|
88
44
|
});
|
|
89
45
|
|
|
90
|
-
it('
|
|
91
|
-
render(
|
|
92
|
-
|
|
46
|
+
it('applies custom className', () => {
|
|
47
|
+
render(
|
|
48
|
+
<Select
|
|
49
|
+
options={[{ value: 'a', label: 'Option A' }]}
|
|
50
|
+
className="custom-select"
|
|
51
|
+
data-testid="select"
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
expect(screen.getByTestId('select')).toHaveClass('custom-select');
|
|
93
55
|
});
|
|
94
56
|
|
|
95
|
-
it('
|
|
96
|
-
render(
|
|
97
|
-
|
|
98
|
-
|
|
57
|
+
it('is disabled when disabled prop is true', () => {
|
|
58
|
+
render(
|
|
59
|
+
<Select
|
|
60
|
+
options={[{ value: 'a', label: 'Option A' }]}
|
|
61
|
+
disabled
|
|
62
|
+
data-testid="select"
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
expect(screen.getByTestId('select')).toBeDisabled();
|
|
99
66
|
});
|
|
100
67
|
});
|
|
@@ -1,72 +1,39 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Separator } from '../separator';
|
|
4
4
|
|
|
5
5
|
describe('Separator', () => {
|
|
6
|
-
it('
|
|
7
|
-
|
|
8
|
-
expect(
|
|
6
|
+
it('renders separator', () => {
|
|
7
|
+
render(<Separator data-testid="sep" />);
|
|
8
|
+
expect(screen.getByTestId('sep')).toBeInTheDocument();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it('
|
|
12
|
-
|
|
13
|
-
expect(
|
|
11
|
+
it('applies custom className', () => {
|
|
12
|
+
render(<Separator className="custom-sep" data-testid="sep" />);
|
|
13
|
+
expect(screen.getByTestId('sep')).toHaveClass('custom-sep');
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it('
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
it('renders horizontal by default', () => {
|
|
17
|
+
render(<Separator data-testid="sep" />);
|
|
18
|
+
const sep = screen.getByTestId('sep');
|
|
19
|
+
expect(sep).toHaveAttribute('data-orientation', 'horizontal');
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
it('
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
it('renders vertical orientation', () => {
|
|
23
|
+
render(<Separator orientation="vertical" data-testid="sep" />);
|
|
24
|
+
const sep = screen.getByTestId('sep');
|
|
25
|
+
expect(sep).toHaveAttribute('data-orientation', 'vertical');
|
|
24
26
|
});
|
|
25
27
|
|
|
26
|
-
it('
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
it('applies decorative attribute', () => {
|
|
29
|
+
render(<Separator decorative data-testid="sep" />);
|
|
30
|
+
const sep = screen.getByTestId('sep');
|
|
31
|
+
expect(sep).toHaveAttribute('role', 'none');
|
|
29
32
|
});
|
|
30
33
|
|
|
31
|
-
it('
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
it('should have aria-orientation attribute', () => {
|
|
37
|
-
const { container } = render(<Separator orientation="horizontal" />);
|
|
38
|
-
expect(container.firstChild).toHaveAttribute(
|
|
39
|
-
'aria-orientation',
|
|
40
|
-
'horizontal'
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should have aria-orientation vertical for vertical separator', () => {
|
|
45
|
-
const { container } = render(<Separator orientation="vertical" />);
|
|
46
|
-
expect(container.firstChild).toHaveAttribute(
|
|
47
|
-
'aria-orientation',
|
|
48
|
-
'vertical'
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should have shrink-0 class', () => {
|
|
53
|
-
const { container } = render(<Separator />);
|
|
54
|
-
expect(container.firstChild).toHaveClass('shrink-0');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should have bg-border class', () => {
|
|
58
|
-
const { container } = render(<Separator />);
|
|
59
|
-
expect(container.firstChild).toHaveClass('bg-border');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should forward ref', () => {
|
|
63
|
-
const ref = { current: null };
|
|
64
|
-
render(<Separator ref={ref} />);
|
|
65
|
-
expect(ref.current).not.toBeNull();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should spread additional props', () => {
|
|
69
|
-
const { container } = render(<Separator data-testid="separator" />);
|
|
70
|
-
expect(container.firstChild).toHaveAttribute('data-testid', 'separator');
|
|
34
|
+
it('has default styling', () => {
|
|
35
|
+
render(<Separator data-testid="sep" />);
|
|
36
|
+
const sep = screen.getByTestId('sep');
|
|
37
|
+
expect(sep).toHaveClass('shrink-0', 'bg-border');
|
|
71
38
|
});
|
|
72
39
|
});
|