@getmicdrop/svelte-components 5.17.1 → 5.17.4
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/calendar/Calendar/MiniMonthCalendar.svelte +5 -7
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +2 -3
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte.d.ts.map +1 -1
- package/dist/calendar/PublicCard/PublicCard.svelte +23 -14
- package/dist/calendar/PublicCard/PublicCard.svelte.d.ts.map +1 -1
- package/dist/calendar/ShowCard/ShowCard.spec.js +1 -7
- package/dist/calendar/ShowCard/ShowCard.svelte +10 -1
- package/dist/calendar/ShowCard/ShowCard.svelte.d.ts.map +1 -1
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +11 -0
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts +2 -0
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts.map +1 -1
- package/dist/components/Heading.spec.d.ts +2 -0
- package/dist/components/Heading.spec.d.ts.map +1 -0
- package/dist/components/Heading.spec.js +89 -0
- package/dist/components/Layout/__tests__/AppShell.test.js +140 -0
- package/dist/components/Text.spec.d.ts +2 -0
- package/dist/components/Text.spec.d.ts.map +1 -0
- package/dist/components/Text.spec.js +89 -0
- package/dist/config.d.ts +102 -0
- package/dist/config.js +147 -1
- package/dist/datetime/README.md +323 -0
- package/dist/forms/createFormStore.svelte.spec.d.ts +2 -0
- package/dist/forms/createFormStore.svelte.spec.d.ts.map +1 -0
- package/dist/forms/createFormStore.svelte.spec.js +387 -0
- package/dist/messages.d.ts +43 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +57 -0
- package/dist/patterns/chat/ChatActivityNotice.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatActivityNotice.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatActivityNotice.spec.js +59 -0
- package/dist/patterns/chat/ChatBubble.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatBubble.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatBubble.spec.js +91 -0
- package/dist/patterns/chat/ChatContainer.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatContainer.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatContainer.spec.js +30 -0
- package/dist/patterns/chat/ChatDateDivider.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatDateDivider.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatDateDivider.spec.js +30 -0
- package/dist/patterns/chat/ChatInvitationBubble.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatInvitationBubble.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatInvitationBubble.spec.js +46 -0
- package/dist/patterns/chat/ChatInvitationNotice.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatInvitationNotice.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatInvitationNotice.spec.js +32 -0
- package/dist/patterns/chat/ChatMessageGroup.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatMessageGroup.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatMessageGroup.spec.js +58 -0
- package/dist/patterns/chat/ChatSlotUpdate.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatSlotUpdate.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatSlotUpdate.spec.js +65 -0
- package/dist/patterns/chat/ChatStatusBadge.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatStatusBadge.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatStatusBadge.spec.js +79 -0
- package/dist/patterns/chat/ChatStatusTransition.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatStatusTransition.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatStatusTransition.spec.js +81 -0
- package/dist/patterns/chat/ChatTextBubble.spec.d.ts +2 -0
- package/dist/patterns/chat/ChatTextBubble.spec.d.ts.map +1 -0
- package/dist/patterns/chat/ChatTextBubble.spec.js +35 -0
- package/dist/patterns/data/DataTable.spec.js +61 -0
- package/dist/patterns/forms/FormGrid.spec.js +34 -0
- package/dist/patterns/layout/Sidebar.spec.js +240 -1
- package/dist/patterns/layout/SidebarTestWrapper.svelte +34 -0
- package/dist/patterns/layout/SidebarTestWrapper.svelte.d.ts +23 -0
- package/dist/patterns/layout/SidebarTestWrapper.svelte.d.ts.map +1 -0
- package/dist/patterns/navigation/Header.spec.js +123 -0
- package/dist/primitives/Accordion/Accordion.spec.js +112 -2
- package/dist/primitives/Accordion/AccordionToggleWrapper.test.svelte +28 -0
- package/dist/primitives/Accordion/AccordionToggleWrapper.test.svelte.d.ts +7 -0
- package/dist/primitives/Accordion/AccordionToggleWrapper.test.svelte.d.ts.map +1 -0
- package/dist/primitives/Avatar/Avatar.spec.js +23 -0
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +102 -0
- package/dist/primitives/BottomSheet/BottomSheetWithActions.test.svelte +20 -0
- package/dist/primitives/BottomSheet/BottomSheetWithActions.test.svelte.d.ts +10 -0
- package/dist/primitives/BottomSheet/BottomSheetWithActions.test.svelte.d.ts.map +1 -0
- package/dist/primitives/Button/ButtonGroup.spec.d.ts +2 -0
- package/dist/primitives/Button/ButtonGroup.spec.d.ts.map +1 -0
- package/dist/primitives/Button/ButtonGroup.spec.js +44 -0
- package/dist/primitives/Checkbox/Checkbox.spec.js +32 -0
- package/dist/primitives/Drawer/Drawer.spec.js +437 -0
- package/dist/primitives/Drawer/DrawerTestWrapper.svelte +86 -0
- package/dist/primitives/Drawer/DrawerTestWrapper.svelte.d.ts +26 -0
- package/dist/primitives/Drawer/DrawerTestWrapper.svelte.d.ts.map +1 -0
- package/dist/primitives/Dropdown/Dropdown.spec.js +116 -0
- package/dist/primitives/Dropdown/DropdownDivider.spec.d.ts +2 -0
- package/dist/primitives/Dropdown/DropdownDivider.spec.d.ts.map +1 -0
- package/dist/primitives/Dropdown/DropdownDivider.spec.js +30 -0
- package/dist/primitives/Dropdown/DropdownItem.spec.js +155 -1
- package/dist/primitives/Dropdown/DropdownItemTestWrapper.svelte +43 -0
- package/dist/primitives/Dropdown/DropdownItemTestWrapper.svelte.d.ts +17 -0
- package/dist/primitives/Dropdown/DropdownItemTestWrapper.svelte.d.ts.map +1 -0
- package/dist/primitives/Helper/Helper.spec.d.ts +2 -0
- package/dist/primitives/Helper/Helper.spec.d.ts.map +1 -0
- package/dist/primitives/Helper/Helper.spec.js +57 -0
- package/dist/primitives/Input/Input.spec.js +664 -0
- package/dist/primitives/Input/Input.svelte +18 -10
- package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.spec.js +414 -0
- package/dist/primitives/Label/Label.spec.js +9 -0
- package/dist/primitives/LandingButton/LandingButton.spec.d.ts +2 -0
- package/dist/primitives/LandingButton/LandingButton.spec.d.ts.map +1 -0
- package/dist/primitives/LandingButton/LandingButton.spec.js +61 -0
- package/dist/primitives/MenuItem/MenuItem.spec.d.ts +2 -0
- package/dist/primitives/MenuItem/MenuItem.spec.d.ts.map +1 -0
- package/dist/primitives/MenuItem/MenuItem.spec.js +130 -0
- package/dist/primitives/Modal/Modal.spec.js +215 -0
- package/dist/primitives/NavItem/NavItem.spec.d.ts +2 -0
- package/dist/primitives/NavItem/NavItem.spec.d.ts.map +1 -0
- package/dist/primitives/NavItem/NavItem.spec.js +97 -0
- package/dist/primitives/SearchResultItem/SearchResultItem.spec.d.ts +2 -0
- package/dist/primitives/SearchResultItem/SearchResultItem.spec.d.ts.map +1 -0
- package/dist/primitives/SearchResultItem/SearchResultItem.spec.js +78 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.spec.d.ts +2 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.spec.d.ts.map +1 -0
- package/dist/primitives/SidebarToggle/SidebarToggle.spec.js +61 -0
- package/dist/primitives/Spinner/Spinner.spec.js +13 -0
- package/dist/primitives/Toggle.spec.js +75 -0
- package/dist/primitives/ToggleTestWrapper.svelte +30 -0
- package/dist/primitives/ToggleTestWrapper.svelte.d.ts +29 -0
- package/dist/primitives/ToggleTestWrapper.svelte.d.ts.map +1 -0
- package/dist/primitives/Tooltip/Tooltip.spec.d.ts +2 -0
- package/dist/primitives/Tooltip/Tooltip.spec.d.ts.map +1 -0
- package/dist/primitives/Tooltip/Tooltip.spec.js +126 -0
- package/dist/recipes/inputs/Search.spec.js +66 -2
- package/dist/recipes/modals/ConfirmationModal.spec.js +190 -0
- package/dist/schemas/__tests__/auth.test.d.ts +2 -0
- package/dist/schemas/__tests__/auth.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/auth.test.js +210 -0
- package/dist/schemas/__tests__/common.test.d.ts +2 -0
- package/dist/schemas/__tests__/common.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/common.test.js +340 -0
- package/dist/schemas/__tests__/domain.test.d.ts +2 -0
- package/dist/schemas/__tests__/domain.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/domain.test.js +293 -0
- package/dist/schemas/__tests__/order.test.d.ts +2 -0
- package/dist/schemas/__tests__/order.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/order.test.js +349 -0
- package/dist/schemas/__tests__/user.test.d.ts +2 -0
- package/dist/schemas/__tests__/user.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/user.test.js +325 -0
- package/dist/schemas/auth.d.ts +41 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +69 -0
- package/dist/schemas/common.d.ts +43 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +157 -0
- package/dist/schemas/event.d.ts +82 -0
- package/dist/schemas/event.d.ts.map +1 -0
- package/dist/schemas/event.js +58 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/order.d.ts +111 -0
- package/dist/schemas/order.d.ts.map +1 -0
- package/dist/schemas/order.js +73 -0
- package/dist/schemas/performer.d.ts +133 -0
- package/dist/schemas/performer.d.ts.map +1 -0
- package/dist/schemas/performer.js +73 -0
- package/dist/schemas/promo.d.ts +87 -0
- package/dist/schemas/promo.d.ts.map +1 -0
- package/dist/schemas/promo.js +98 -0
- package/dist/schemas/ticket.d.ts +104 -0
- package/dist/schemas/ticket.d.ts.map +1 -0
- package/dist/schemas/ticket.js +82 -0
- package/dist/schemas/user.d.ts +92 -0
- package/dist/schemas/user.d.ts.map +1 -0
- package/dist/schemas/user.js +53 -0
- package/dist/schemas/venue.d.ts +95 -0
- package/dist/schemas/venue.d.ts.map +1 -0
- package/dist/schemas/venue.js +52 -0
- package/dist/stores/auth.svelte.spec.d.ts +2 -0
- package/dist/stores/auth.svelte.spec.d.ts.map +1 -0
- package/dist/stores/auth.svelte.spec.js +112 -0
- package/dist/stores/formDataStore.svelte.spec.d.ts +2 -0
- package/dist/stores/formDataStore.svelte.spec.d.ts.map +1 -0
- package/dist/stores/formDataStore.svelte.spec.js +150 -0
- package/dist/stores/formSave.svelte.spec.d.ts +2 -0
- package/dist/stores/formSave.svelte.spec.d.ts.map +1 -0
- package/dist/stores/formSave.svelte.spec.js +196 -0
- package/dist/stores/navigation.spec.d.ts +2 -0
- package/dist/stores/navigation.spec.d.ts.map +1 -0
- package/dist/stores/navigation.spec.js +53 -0
- package/dist/telemetry.spec.js +5 -0
- package/dist/tokens/__tests__/sizing.test.js +2 -2
- package/dist/tokens/sizing.d.ts +5 -0
- package/dist/tokens/sizing.d.ts.map +1 -1
- package/dist/tokens/sizing.js +6 -0
- package/dist/utils/haptic.spec.d.ts +2 -0
- package/dist/utils/haptic.spec.d.ts.map +1 -0
- package/dist/utils/haptic.spec.js +153 -0
- package/dist/utils/imageOptimizer.spec.d.ts +2 -0
- package/dist/utils/imageOptimizer.spec.d.ts.map +1 -0
- package/dist/utils/imageOptimizer.spec.js +201 -0
- package/dist/utils/logger.spec.d.ts +2 -0
- package/dist/utils/logger.spec.d.ts.map +1 -0
- package/dist/utils/logger.spec.js +95 -0
- package/package.json +1 -2
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatContainer from './ChatContainer.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatContainer', () => {
|
|
6
|
+
test('renders without crashing', () => {
|
|
7
|
+
const { container } = render(ChatContainer);
|
|
8
|
+
expect(container.firstElementChild).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('has flex column layout', () => {
|
|
12
|
+
const { container } = render(ChatContainer);
|
|
13
|
+
expect(container.querySelector('.flex-col, .flex')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('has scrollable content area', () => {
|
|
17
|
+
const { container } = render(ChatContainer);
|
|
18
|
+
expect(container.querySelector('.overflow-y-auto, [class*="overflow"]')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('applies custom className', () => {
|
|
22
|
+
const { container } = render(ChatContainer, { props: { className: 'my-container' } });
|
|
23
|
+
expect(container.querySelector('.my-container')).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('has white background', () => {
|
|
27
|
+
const { container } = render(ChatContainer);
|
|
28
|
+
expect(container.querySelector('[class*="bg-white"]')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatDateDivider.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatDateDivider.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatDateDivider from './ChatDateDivider.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatDateDivider', () => {
|
|
6
|
+
test('renders the label', () => {
|
|
7
|
+
render(ChatDateDivider, { props: { label: 'Today' } });
|
|
8
|
+
expect(screen.getByText('Today')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('renders long date label', () => {
|
|
12
|
+
render(ChatDateDivider, { props: { label: 'Monday, Jan 15, 2024' } });
|
|
13
|
+
expect(screen.getByText('Monday, Jan 15, 2024')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('has centered text', () => {
|
|
17
|
+
const { container } = render(ChatDateDivider, { props: { label: 'Today' } });
|
|
18
|
+
expect(container.querySelector('.text-center')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('has pill styling on label', () => {
|
|
22
|
+
const { container } = render(ChatDateDivider, { props: { label: 'Today' } });
|
|
23
|
+
expect(container.querySelector('.rounded-full, [class*="rounded"]')).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('applies custom className', () => {
|
|
27
|
+
const { container } = render(ChatDateDivider, { props: { label: 'Today', className: 'my-divider' } });
|
|
28
|
+
expect(container.querySelector('.my-divider')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatInvitationBubble.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatInvitationBubble.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatInvitationBubble from './ChatInvitationBubble.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatInvitationBubble', () => {
|
|
6
|
+
test('renders performer name', () => {
|
|
7
|
+
render(ChatInvitationBubble, { props: { performerName: 'Alice' } });
|
|
8
|
+
expect(screen.getByText(/Invited Alice/i)).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('has blue background', () => {
|
|
12
|
+
const { container } = render(ChatInvitationBubble, { props: { performerName: 'Bob' } });
|
|
13
|
+
expect(container.querySelector('[class*="blue"]')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('renders invitation icon', () => {
|
|
17
|
+
const { container } = render(ChatInvitationBubble, { props: { performerName: 'Test' } });
|
|
18
|
+
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('outbound true applies rounded-br-sm', () => {
|
|
22
|
+
const { container } = render(ChatInvitationBubble, {
|
|
23
|
+
props: { performerName: 'Test', outbound: true }
|
|
24
|
+
});
|
|
25
|
+
expect(container.querySelector('.rounded-br-sm')).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('outbound false applies rounded-bl-sm', () => {
|
|
29
|
+
const { container } = render(ChatInvitationBubble, {
|
|
30
|
+
props: { performerName: 'Test', outbound: false }
|
|
31
|
+
});
|
|
32
|
+
expect(container.querySelector('.rounded-bl-sm')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('default outbound is true', () => {
|
|
36
|
+
const { container } = render(ChatInvitationBubble, { props: { performerName: 'Test' } });
|
|
37
|
+
expect(container.querySelector('.rounded-br-sm')).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('applies custom className', () => {
|
|
41
|
+
const { container } = render(ChatInvitationBubble, {
|
|
42
|
+
props: { performerName: 'Test', className: 'my-invite' }
|
|
43
|
+
});
|
|
44
|
+
expect(container.querySelector('.my-invite')).toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatInvitationNotice.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatInvitationNotice.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatInvitationNotice from './ChatInvitationNotice.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatInvitationNotice', () => {
|
|
6
|
+
test('renders performer name', () => {
|
|
7
|
+
render(ChatInvitationNotice, { props: { performerName: 'Alice' } });
|
|
8
|
+
expect(screen.getByText(/Invited Alice/i)).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('has blue text color', () => {
|
|
12
|
+
const { container } = render(ChatInvitationNotice, { props: { performerName: 'Bob' } });
|
|
13
|
+
expect(container.querySelector('[class*="blue"]')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('renders icon', () => {
|
|
17
|
+
const { container } = render(ChatInvitationNotice, { props: { performerName: 'Test' } });
|
|
18
|
+
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('has inline flex layout', () => {
|
|
22
|
+
const { container } = render(ChatInvitationNotice, { props: { performerName: 'Test' } });
|
|
23
|
+
expect(container.querySelector('.inline-flex, .flex')).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('applies custom className', () => {
|
|
27
|
+
const { container } = render(ChatInvitationNotice, {
|
|
28
|
+
props: { performerName: 'Test', className: 'my-notice' }
|
|
29
|
+
});
|
|
30
|
+
expect(container.querySelector('.my-notice')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageGroup.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatMessageGroup.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatMessageGroup from './ChatMessageGroup.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatMessageGroup', () => {
|
|
6
|
+
test('renders with default inbound direction', () => {
|
|
7
|
+
const { container } = render(ChatMessageGroup);
|
|
8
|
+
const el = container.querySelector('.items-start');
|
|
9
|
+
expect(el).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('outbound uses flex-row-reverse', () => {
|
|
13
|
+
const { container } = render(ChatMessageGroup, { props: { direction: 'outbound' } });
|
|
14
|
+
expect(container.querySelector('.flex-row-reverse')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('outbound uses items-end', () => {
|
|
18
|
+
const { container } = render(ChatMessageGroup, { props: { direction: 'outbound' } });
|
|
19
|
+
expect(container.querySelector('.items-end')).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('shows sender name for inbound', () => {
|
|
23
|
+
render(ChatMessageGroup, { props: { direction: 'inbound', senderName: 'Bob' } });
|
|
24
|
+
expect(screen.getByText('Bob')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('hides sender name for outbound even when provided', () => {
|
|
28
|
+
const { container } = render(ChatMessageGroup, {
|
|
29
|
+
props: { direction: 'outbound', senderName: 'Bob' }
|
|
30
|
+
});
|
|
31
|
+
// senderName should not appear as standalone element for outbound
|
|
32
|
+
// but may appear in timestamp area
|
|
33
|
+
expect(container.firstElementChild).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('shows timestamp', () => {
|
|
37
|
+
render(ChatMessageGroup, { props: { timestamp: '3:45 PM' } });
|
|
38
|
+
expect(screen.getByText(/3:45 PM/)).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('outbound timestamp includes sender name', () => {
|
|
42
|
+
const { container } = render(ChatMessageGroup, {
|
|
43
|
+
props: { direction: 'outbound', senderName: 'Alice', timestamp: '3:45 PM' }
|
|
44
|
+
});
|
|
45
|
+
expect(container.textContent).toContain('Alice');
|
|
46
|
+
expect(container.textContent).toContain('3:45 PM');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('hides timestamp when not provided', () => {
|
|
50
|
+
const { container } = render(ChatMessageGroup, { props: { direction: 'inbound' } });
|
|
51
|
+
expect(container.textContent.trim()).toBe('');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('applies custom className', () => {
|
|
55
|
+
const { container } = render(ChatMessageGroup, { props: { className: 'my-group' } });
|
|
56
|
+
expect(container.querySelector('.my-group')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatSlotUpdate.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatSlotUpdate.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatSlotUpdate from './ChatSlotUpdate.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatSlotUpdate', () => {
|
|
6
|
+
test('renders fromValue and toValue', () => {
|
|
7
|
+
const { container } = render(ChatSlotUpdate, {
|
|
8
|
+
props: { fromValue: '8:00 PM', toValue: '9:00 PM' }
|
|
9
|
+
});
|
|
10
|
+
expect(container.textContent).toContain('8:00 PM');
|
|
11
|
+
expect(container.textContent).toContain('9:00 PM');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('renders arrow between values', () => {
|
|
15
|
+
const { container } = render(ChatSlotUpdate, {
|
|
16
|
+
props: { fromValue: 'Slot A', toValue: 'Slot B' }
|
|
17
|
+
});
|
|
18
|
+
expect(container.textContent).toContain('→');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('bubble variant has rounded styling', () => {
|
|
22
|
+
const { container } = render(ChatSlotUpdate, {
|
|
23
|
+
props: { fromValue: 'A', toValue: 'B', variant: 'bubble' }
|
|
24
|
+
});
|
|
25
|
+
const el = container.querySelector('[class*="rounded"]');
|
|
26
|
+
expect(el).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('bubble variant inbound has rounded-bl-sm', () => {
|
|
30
|
+
const { container } = render(ChatSlotUpdate, {
|
|
31
|
+
props: { fromValue: 'A', toValue: 'B', variant: 'bubble', outbound: false }
|
|
32
|
+
});
|
|
33
|
+
expect(container.querySelector('.rounded-bl-sm')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('bubble variant outbound has rounded-br-sm', () => {
|
|
37
|
+
const { container } = render(ChatSlotUpdate, {
|
|
38
|
+
props: { fromValue: 'A', toValue: 'B', variant: 'bubble', outbound: true }
|
|
39
|
+
});
|
|
40
|
+
expect(container.querySelector('.rounded-br-sm')).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('inline variant has smaller styling', () => {
|
|
44
|
+
const { container } = render(ChatSlotUpdate, {
|
|
45
|
+
props: { fromValue: 'A', toValue: 'B', variant: 'inline' }
|
|
46
|
+
});
|
|
47
|
+
const el = container.querySelector('.text-xs');
|
|
48
|
+
expect(el).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('default variant is bubble', () => {
|
|
52
|
+
const { container } = render(ChatSlotUpdate, {
|
|
53
|
+
props: { fromValue: 'A', toValue: 'B' }
|
|
54
|
+
});
|
|
55
|
+
const el = container.querySelector('[class*="rounded"]');
|
|
56
|
+
expect(el).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('applies custom className', () => {
|
|
60
|
+
const { container } = render(ChatSlotUpdate, {
|
|
61
|
+
props: { fromValue: 'A', toValue: 'B', className: 'custom-slot' }
|
|
62
|
+
});
|
|
63
|
+
expect(container.querySelector('.custom-slot')).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatStatusBadge.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatStatusBadge.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatStatusBadge from './ChatStatusBadge.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatStatusBadge', () => {
|
|
6
|
+
test('renders confirmed status with green styling', () => {
|
|
7
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'confirmed' } });
|
|
8
|
+
expect(screen.getByText(/confirmed/i)).toBeInTheDocument();
|
|
9
|
+
const badge = container.querySelector('[class*="green"]');
|
|
10
|
+
expect(badge).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('renders declined status with red styling', () => {
|
|
14
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'declined' } });
|
|
15
|
+
expect(screen.getByText(/declined/i)).toBeInTheDocument();
|
|
16
|
+
const badge = container.querySelector('[class*="red"]');
|
|
17
|
+
expect(badge).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('renders canceled status with red styling', () => {
|
|
21
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'canceled' } });
|
|
22
|
+
expect(screen.getByText(/canceled/i)).toBeInTheDocument();
|
|
23
|
+
const badge = container.querySelector('[class*="red"]');
|
|
24
|
+
expect(badge).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('renders invited status with blue styling', () => {
|
|
28
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'invited' } });
|
|
29
|
+
expect(screen.getByText(/invited/i)).toBeInTheDocument();
|
|
30
|
+
const badge = container.querySelector('[class*="blue"]');
|
|
31
|
+
expect(badge).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('renders unknown status with gray styling', () => {
|
|
35
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'pending' } });
|
|
36
|
+
expect(screen.getByText(/pending/i)).toBeInTheDocument();
|
|
37
|
+
const badge = container.querySelector('[class*="gray"]');
|
|
38
|
+
expect(badge).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('outbound applies rounded-br-sm', () => {
|
|
42
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'confirmed', outbound: true } });
|
|
43
|
+
expect(container.querySelector('.rounded-br-sm')).toBeInTheDocument();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('inbound applies rounded-bl-sm', () => {
|
|
47
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'confirmed', outbound: false } });
|
|
48
|
+
expect(container.querySelector('.rounded-bl-sm')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('applies custom className', () => {
|
|
52
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'confirmed', className: 'my-badge' } });
|
|
53
|
+
expect(container.querySelector('.my-badge')).toBeInTheDocument();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('renders icon for confirmed status', () => {
|
|
57
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'confirmed' } });
|
|
58
|
+
const svg = container.querySelector('svg');
|
|
59
|
+
expect(svg).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('renders icon for declined status', () => {
|
|
63
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'declined' } });
|
|
64
|
+
const svg = container.querySelector('svg');
|
|
65
|
+
expect(svg).toBeInTheDocument();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('renders icon for invited status', () => {
|
|
69
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'invited' } });
|
|
70
|
+
const svg = container.querySelector('svg');
|
|
71
|
+
expect(svg).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('no icon for unknown status', () => {
|
|
75
|
+
const { container } = render(ChatStatusBadge, { props: { status: 'something-else' } });
|
|
76
|
+
const svg = container.querySelector('svg');
|
|
77
|
+
expect(svg).toBeNull();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatStatusTransition.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatStatusTransition.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatStatusTransition from './ChatStatusTransition.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatStatusTransition', () => {
|
|
6
|
+
test('renders from and to status text', () => {
|
|
7
|
+
render(ChatStatusTransition, { props: { fromStatus: 'invited', toStatus: 'confirmed' } });
|
|
8
|
+
expect(screen.getByText(/invited/i)).toBeInTheDocument();
|
|
9
|
+
expect(screen.getByText(/confirmed/i)).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('renders arrow separator', () => {
|
|
13
|
+
const { container } = render(ChatStatusTransition, {
|
|
14
|
+
props: { fromStatus: 'invited', toStatus: 'confirmed' }
|
|
15
|
+
});
|
|
16
|
+
expect(container.textContent).toContain('→');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('confirmed status shows icon', () => {
|
|
20
|
+
const { container } = render(ChatStatusTransition, {
|
|
21
|
+
props: { fromStatus: 'invited', toStatus: 'confirmed' }
|
|
22
|
+
});
|
|
23
|
+
const svgs = container.querySelectorAll('svg');
|
|
24
|
+
expect(svgs.length).toBeGreaterThanOrEqual(1);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('declined status shows icon', () => {
|
|
28
|
+
const { container } = render(ChatStatusTransition, {
|
|
29
|
+
props: { fromStatus: 'confirmed', toStatus: 'declined' }
|
|
30
|
+
});
|
|
31
|
+
const svgs = container.querySelectorAll('svg');
|
|
32
|
+
expect(svgs.length).toBeGreaterThanOrEqual(1);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('canceled status shows icon', () => {
|
|
36
|
+
const { container } = render(ChatStatusTransition, {
|
|
37
|
+
props: { fromStatus: 'confirmed', toStatus: 'canceled' }
|
|
38
|
+
});
|
|
39
|
+
const svgs = container.querySelectorAll('svg');
|
|
40
|
+
expect(svgs.length).toBeGreaterThanOrEqual(1);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('unknown status does not show icon', () => {
|
|
44
|
+
const { container } = render(ChatStatusTransition, {
|
|
45
|
+
props: { fromStatus: 'unknown', toStatus: 'unknown' }
|
|
46
|
+
});
|
|
47
|
+
const svgs = container.querySelectorAll('svg');
|
|
48
|
+
expect(svgs.length).toBe(0);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('confirmed from shows green color', () => {
|
|
52
|
+
const { container } = render(ChatStatusTransition, {
|
|
53
|
+
props: { fromStatus: 'confirmed', toStatus: 'declined' }
|
|
54
|
+
});
|
|
55
|
+
const green = container.querySelector('[class*="green"]');
|
|
56
|
+
expect(green).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test('declined to shows red color', () => {
|
|
60
|
+
const { container } = render(ChatStatusTransition, {
|
|
61
|
+
props: { fromStatus: 'confirmed', toStatus: 'declined' }
|
|
62
|
+
});
|
|
63
|
+
const red = container.querySelector('[class*="red"]');
|
|
64
|
+
expect(red).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('invited status shows blue color', () => {
|
|
68
|
+
const { container } = render(ChatStatusTransition, {
|
|
69
|
+
props: { fromStatus: 'invited', toStatus: 'confirmed' }
|
|
70
|
+
});
|
|
71
|
+
const blue = container.querySelector('[class*="blue"]');
|
|
72
|
+
expect(blue).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('applies custom className', () => {
|
|
76
|
+
const { container } = render(ChatStatusTransition, {
|
|
77
|
+
props: { fromStatus: 'invited', toStatus: 'confirmed', className: 'my-transition' }
|
|
78
|
+
});
|
|
79
|
+
expect(container.querySelector('.my-transition')).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatTextBubble.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/chat/ChatTextBubble.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { expect, describe, test } from 'vitest';
|
|
3
|
+
import ChatTextBubble from './ChatTextBubble.svelte';
|
|
4
|
+
|
|
5
|
+
describe('ChatTextBubble', () => {
|
|
6
|
+
test('renders with default inbound styling', () => {
|
|
7
|
+
const { container } = render(ChatTextBubble);
|
|
8
|
+
expect(container.querySelector('.rounded-bl-sm')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('inbound has gray background', () => {
|
|
12
|
+
const { container } = render(ChatTextBubble, { props: { direction: 'inbound' } });
|
|
13
|
+
expect(container.querySelector('[class*="gray"]')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('outbound has blue background', () => {
|
|
17
|
+
const { container } = render(ChatTextBubble, { props: { direction: 'outbound' } });
|
|
18
|
+
expect(container.querySelector('[class*="blue"]')).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('outbound has rounded-br-sm', () => {
|
|
22
|
+
const { container } = render(ChatTextBubble, { props: { direction: 'outbound' } });
|
|
23
|
+
expect(container.querySelector('.rounded-br-sm')).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('outbound has white text', () => {
|
|
27
|
+
const { container } = render(ChatTextBubble, { props: { direction: 'outbound' } });
|
|
28
|
+
expect(container.querySelector('.text-white')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('applies custom className', () => {
|
|
32
|
+
const { container } = render(ChatTextBubble, { props: { className: 'my-text' } });
|
|
33
|
+
expect(container.querySelector('.my-text')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
2
|
import { render, screen, cleanup } from '@testing-library/svelte';
|
|
3
|
+
import { createRawSnippet } from 'svelte';
|
|
3
4
|
import DataTable from './DataTable.svelte';
|
|
4
5
|
|
|
5
6
|
describe('DataTable Component', () => {
|
|
@@ -193,4 +194,64 @@ describe('DataTable Component', () => {
|
|
|
193
194
|
expect(tbody.className).not.toContain('[&>tr]:hover');
|
|
194
195
|
});
|
|
195
196
|
});
|
|
197
|
+
|
|
198
|
+
describe('header snippet', () => {
|
|
199
|
+
it('does not render thead when header is not provided', () => {
|
|
200
|
+
const { container } = render(DataTable);
|
|
201
|
+
const thead = container.querySelector('thead');
|
|
202
|
+
expect(thead).not.toBeInTheDocument();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('renders thead when header snippet is provided', () => {
|
|
206
|
+
const header = createRawSnippet(() => ({
|
|
207
|
+
render: () => `<tr><th>Column</th></tr>`
|
|
208
|
+
}));
|
|
209
|
+
const { container } = render(DataTable, { props: { header } });
|
|
210
|
+
const thead = container.querySelector('thead');
|
|
211
|
+
expect(thead).toBeInTheDocument();
|
|
212
|
+
expect(thead).toHaveClass('text-xs', 'uppercase', 'bg-gray-50');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('header receives cellSize as argument', () => {
|
|
216
|
+
const header = createRawSnippet(() => ({
|
|
217
|
+
render: () => `<tr><th>Name</th></tr>`
|
|
218
|
+
}));
|
|
219
|
+
const { container } = render(DataTable, { props: { header, size: 'lg' } });
|
|
220
|
+
const thead = container.querySelector('thead');
|
|
221
|
+
expect(thead).toBeInTheDocument();
|
|
222
|
+
expect(thead.textContent).toContain('Name');
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('thead has dark mode classes', () => {
|
|
226
|
+
const header = createRawSnippet(() => ({
|
|
227
|
+
render: () => `<tr><th>Col</th></tr>`
|
|
228
|
+
}));
|
|
229
|
+
const { container } = render(DataTable, { props: { header } });
|
|
230
|
+
const thead = container.querySelector('thead');
|
|
231
|
+
expect(thead.className).toContain('dark:bg-gray-700');
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('children snippet', () => {
|
|
236
|
+
it('renders children content inside tbody', () => {
|
|
237
|
+
const children = createRawSnippet(() => ({
|
|
238
|
+
render: () => `<tr><td>Row data</td></tr>`
|
|
239
|
+
}));
|
|
240
|
+
const { container } = render(DataTable, { props: { children } });
|
|
241
|
+
const tbody = container.querySelector('tbody');
|
|
242
|
+
expect(tbody.textContent).toContain('Row data');
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('renders both header and children together', () => {
|
|
246
|
+
const header = createRawSnippet(() => ({
|
|
247
|
+
render: () => `<tr><th>Header</th></tr>`
|
|
248
|
+
}));
|
|
249
|
+
const children = createRawSnippet(() => ({
|
|
250
|
+
render: () => `<tr><td>Body</td></tr>`
|
|
251
|
+
}));
|
|
252
|
+
const { container } = render(DataTable, { props: { header, children } });
|
|
253
|
+
expect(container.querySelector('thead')).toBeInTheDocument();
|
|
254
|
+
expect(container.querySelector('tbody').textContent).toContain('Body');
|
|
255
|
+
});
|
|
256
|
+
});
|
|
196
257
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/svelte';
|
|
2
|
+
import { createRawSnippet } from 'svelte';
|
|
2
3
|
import { expect, describe, test } from 'vitest';
|
|
3
4
|
import FormGrid from './FormGrid.svelte';
|
|
4
5
|
|
|
@@ -123,3 +124,36 @@ describe('FormGrid Combinations', () => {
|
|
|
123
124
|
expect(grid).toHaveClass('extra');
|
|
124
125
|
});
|
|
125
126
|
});
|
|
127
|
+
|
|
128
|
+
describe('FormGrid children snippet', () => {
|
|
129
|
+
test('renders children content inside grid', () => {
|
|
130
|
+
const children = createRawSnippet(() => ({
|
|
131
|
+
render: () => `<div class="field">Field 1</div>`
|
|
132
|
+
}));
|
|
133
|
+
const { container } = render(FormGrid, { props: { children } });
|
|
134
|
+
const grid = container.querySelector('.grid');
|
|
135
|
+
expect(grid.textContent).toContain('Field 1');
|
|
136
|
+
expect(grid.querySelector('.field')).toBeInTheDocument();
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('renders without children (optional chaining)', () => {
|
|
140
|
+
const { container } = render(FormGrid);
|
|
141
|
+
const grid = container.querySelector('.grid');
|
|
142
|
+
expect(grid).toBeInTheDocument();
|
|
143
|
+
expect(grid.children.length).toBe(0);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('FormGrid fallback values', () => {
|
|
148
|
+
test('invalid cols falls back to md:grid-cols-2', () => {
|
|
149
|
+
const { container } = render(FormGrid, { props: { cols: 99 } });
|
|
150
|
+
const grid = container.querySelector('div');
|
|
151
|
+
expect(grid).toHaveClass('md:grid-cols-2');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test('invalid gap falls back to gap-4', () => {
|
|
155
|
+
const { container } = render(FormGrid, { props: { gap: 99 } });
|
|
156
|
+
const grid = container.querySelector('div');
|
|
157
|
+
expect(grid).toHaveClass('gap-4');
|
|
158
|
+
});
|
|
159
|
+
});
|