@skeletonlabs/skeleton 2.3.0 → 2.4.0-dev.4fe5e62f
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/actions/Filters/filter.test.d.ts +1 -0
- package/dist/actions/Filters/filter.test.js +36 -0
- package/dist/components/Accordion/Accordion.test.d.ts +1 -0
- package/dist/components/Accordion/Accordion.test.js +25 -0
- package/dist/components/Accordion/AccordionItem.test.d.ts +1 -0
- package/dist/components/Accordion/AccordionItem.test.js +22 -0
- package/dist/components/AppBar/AppBar.test.d.ts +1 -0
- package/dist/components/AppBar/AppBar.test.js +28 -0
- package/dist/components/AppRail/AppRail.test.d.ts +1 -0
- package/dist/components/AppRail/AppRail.test.js +28 -0
- package/dist/components/AppRail/AppRailTile.svelte +9 -5
- package/dist/components/AppRail/AppRailTile.svelte.d.ts +0 -1
- package/dist/components/AppRail/AppRailTile.test.d.ts +1 -0
- package/dist/components/AppRail/AppRailTile.test.js +27 -0
- package/dist/components/AppShell/AppShell.test.d.ts +1 -0
- package/dist/components/AppShell/AppShell.test.js +23 -0
- package/dist/components/Autocomplete/Autocomplete.svelte +2 -1
- package/dist/components/Autocomplete/Autocomplete.svelte.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.test.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.test.js +125 -0
- package/dist/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/components/Avatar/Avatar.test.js +35 -0
- package/dist/components/ConicGradient/ConicGradient.test.d.ts +1 -0
- package/dist/components/ConicGradient/ConicGradient.test.js +23 -0
- package/dist/components/FileButton/FileButton.test.d.ts +1 -0
- package/dist/components/FileButton/FileButton.test.js +29 -0
- package/dist/components/FileDropzone/FileDropzone.test.d.ts +1 -0
- package/dist/components/FileDropzone/FileDropzone.test.js +29 -0
- package/dist/components/ListBox/ListBox.test.d.ts +1 -0
- package/dist/components/ListBox/ListBox.test.js +42 -0
- package/dist/components/ListBox/ListBoxItem.test.d.ts +1 -0
- package/dist/components/ListBox/ListBoxItem.test.js +29 -0
- package/dist/components/Paginator/Paginator.test.d.ts +1 -0
- package/dist/components/Paginator/Paginator.test.js +26 -0
- package/dist/components/ProgressBar/ProgressBar.svelte +3 -2
- package/dist/components/ProgressBar/ProgressBar.svelte.d.ts +4 -2
- package/dist/components/ProgressBar/ProgressBar.test.d.ts +1 -0
- package/dist/components/ProgressBar/ProgressBar.test.js +24 -0
- package/dist/components/ProgressRadial/ProgressRadial.svelte +3 -2
- package/dist/components/ProgressRadial/ProgressRadial.svelte.d.ts +2 -0
- package/dist/components/ProgressRadial/ProgressRadial.test.d.ts +1 -0
- package/dist/components/ProgressRadial/ProgressRadial.test.js +24 -0
- package/dist/components/Radio/RadioGroup.test.d.ts +1 -0
- package/dist/components/Radio/RadioGroup.test.js +27 -0
- package/dist/components/Radio/RadioItem.test.d.ts +1 -0
- package/dist/components/Radio/RadioItem.test.js +24 -0
- package/dist/components/RangeSlider/RangeSlider.test.d.ts +1 -0
- package/dist/components/RangeSlider/RangeSlider.test.js +38 -0
- package/dist/components/Ratings/Ratings.test.d.ts +1 -0
- package/dist/components/Ratings/Ratings.test.js +20 -0
- package/dist/components/SlideToggle/SlideToggle.test.d.ts +1 -0
- package/dist/components/SlideToggle/SlideToggle.test.js +21 -0
- package/dist/components/Stepper/Step.test.d.ts +1 -0
- package/dist/components/Stepper/Step.test.js +21 -0
- package/dist/components/Stepper/Stepper.test.d.ts +1 -0
- package/dist/components/Stepper/Stepper.test.js +26 -0
- package/dist/components/Tab/Tab.test.d.ts +1 -0
- package/dist/components/Tab/Tab.test.js +30 -0
- package/dist/components/Tab/TabGroup.test.d.ts +1 -0
- package/dist/components/Tab/TabGroup.test.js +26 -0
- package/dist/components/Table/Table.svelte +5 -5
- package/dist/components/TreeView/RecursiveTreeView.svelte +21 -2
- package/dist/components/TreeView/RecursiveTreeView.svelte.d.ts +5 -0
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte +48 -21
- package/dist/components/TreeView/RecursiveTreeViewItem.svelte.d.ts +3 -0
- package/dist/components/TreeView/TreeView.test.d.ts +1 -0
- package/dist/components/TreeView/TreeView.test.js +28 -0
- package/dist/components/TreeView/TreeViewItem.svelte +9 -13
- package/dist/components/TreeView/TreeViewItem.test.d.ts +1 -0
- package/dist/components/TreeView/TreeViewItem.test.js +26 -0
- package/dist/components/TreeView/types.d.ts +9 -4
- package/dist/utilities/CodeBlock/CodeBlock.test.d.ts +1 -0
- package/dist/utilities/CodeBlock/CodeBlock.test.js +24 -0
- package/dist/utilities/Drawer/Drawer.svelte +16 -12
- package/dist/utilities/Drawer/Drawer.svelte.d.ts +10 -8
- package/dist/utilities/Drawer/Drawer.test.d.ts +1 -0
- package/dist/utilities/Drawer/Drawer.test.js +13 -0
- package/dist/utilities/Drawer/types.d.ts +2 -2
- package/dist/utilities/LightSwitch/LightSwitch.test.d.ts +1 -0
- package/dist/utilities/LightSwitch/LightSwitch.test.js +16 -0
- package/dist/utilities/Modal/Modal.test.d.ts +1 -0
- package/dist/utilities/Modal/Modal.test.js +39 -0
- package/dist/utilities/Modal/stores.d.ts +1 -1
- package/dist/utilities/Modal/stores.js +1 -1
- package/dist/utilities/Toast/Toast.test.d.ts +1 -0
- package/dist/utilities/Toast/Toast.test.js +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import Tree from './TreeView.svelte';
|
|
4
|
+
describe('Tree.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(Tree);
|
|
7
|
+
expect(getByTestId('tree')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', async () => {
|
|
10
|
+
const { getByTestId } = render(Tree, {
|
|
11
|
+
props: {
|
|
12
|
+
width: 'w-full',
|
|
13
|
+
spacing: 'space-y-1',
|
|
14
|
+
padding: 'py-4',
|
|
15
|
+
indent: 'ml-4',
|
|
16
|
+
hover: 'hover:variant-soft',
|
|
17
|
+
rounded: 'rounded-container-token',
|
|
18
|
+
caretOpen: 'rotate-180',
|
|
19
|
+
caretClosed: 'rotate-90',
|
|
20
|
+
regionSummary: 'bg-red-600',
|
|
21
|
+
regionCaret: 'bg-red-600',
|
|
22
|
+
regionChildren: 'bg-red-600',
|
|
23
|
+
labelledby: 'tree label'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
expect(getByTestId('tree')).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -37,23 +37,12 @@ $:
|
|
|
37
37
|
$:
|
|
38
38
|
if (multiple)
|
|
39
39
|
updateGroup(checked, indeterminate);
|
|
40
|
-
$:
|
|
41
|
-
if (!multiple)
|
|
42
|
-
updateRadio(group);
|
|
43
|
-
$:
|
|
44
|
-
if (!multiple)
|
|
45
|
-
updateRadioGroup(checked);
|
|
46
|
-
let initUpdate = true;
|
|
47
40
|
function updateCheckbox(group2, indeterminate2) {
|
|
48
41
|
if (!Array.isArray(group2))
|
|
49
42
|
return;
|
|
50
43
|
checked = group2.indexOf(value) >= 0;
|
|
51
44
|
dispatch("groupChange", { checked, indeterminate: indeterminate2 });
|
|
52
45
|
dispatch("childChange");
|
|
53
|
-
if (initUpdate) {
|
|
54
|
-
onParentChange();
|
|
55
|
-
initUpdate = false;
|
|
56
|
-
}
|
|
57
46
|
}
|
|
58
47
|
function updateGroup(checked2, indeterminate2) {
|
|
59
48
|
if (!Array.isArray(group))
|
|
@@ -63,16 +52,23 @@ function updateGroup(checked2, indeterminate2) {
|
|
|
63
52
|
if (index < 0) {
|
|
64
53
|
group.push(value);
|
|
65
54
|
group = group;
|
|
66
|
-
onParentChange();
|
|
67
55
|
}
|
|
68
56
|
} else {
|
|
69
57
|
if (index >= 0) {
|
|
70
58
|
group.splice(index, 1);
|
|
71
59
|
group = group;
|
|
72
|
-
onParentChange();
|
|
73
60
|
}
|
|
74
61
|
}
|
|
62
|
+
if (!indeterminate2) {
|
|
63
|
+
onParentChange();
|
|
64
|
+
}
|
|
75
65
|
}
|
|
66
|
+
$:
|
|
67
|
+
if (!multiple)
|
|
68
|
+
updateRadio(group);
|
|
69
|
+
$:
|
|
70
|
+
if (!multiple)
|
|
71
|
+
updateRadioGroup(checked);
|
|
76
72
|
function updateRadio(group2) {
|
|
77
73
|
checked = group2 === value;
|
|
78
74
|
dispatch("groupChange", { checked, indeterminate: false });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import TreeItem from './TreeViewItem.svelte';
|
|
4
|
+
describe('TreeItem.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(TreeItem);
|
|
7
|
+
expect(getByTestId('tree-item')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it('Renders with all props', async () => {
|
|
10
|
+
const { getByTestId } = render(TreeItem, {
|
|
11
|
+
props: {
|
|
12
|
+
open: true,
|
|
13
|
+
padding: 'py-4',
|
|
14
|
+
indent: 'ml-4',
|
|
15
|
+
hover: 'hover:variant-soft',
|
|
16
|
+
rounded: 'rounded-container-token',
|
|
17
|
+
caretOpen: 'rotate-180',
|
|
18
|
+
caretClosed: 'rotate-90',
|
|
19
|
+
regionSummary: 'bg-red-600',
|
|
20
|
+
regionCaret: 'bg-red-600',
|
|
21
|
+
regionChildren: 'bg-red-600'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
expect(getByTestId('tree-item')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import type { ComponentType } from 'svelte';
|
|
1
2
|
export interface TreeViewNode {
|
|
2
3
|
/** Nodes Unique ID */
|
|
3
4
|
id: string;
|
|
4
|
-
/** Main content. accepts HTML. */
|
|
5
|
-
content: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
5
|
+
/** Main content. accepts HTML or svelte component. */
|
|
6
|
+
content: string | ComponentType;
|
|
7
|
+
/** Main content props. only used when the Content is a svelte component. */
|
|
8
|
+
contentProps?: object;
|
|
9
|
+
/** Lead content. accepts HTML or svelte component. */
|
|
10
|
+
lead?: string | ComponentType;
|
|
11
|
+
/** lead props. only used when the Lead is a svelte component. */
|
|
12
|
+
leadProps?: object;
|
|
8
13
|
/** children nodes. */
|
|
9
14
|
children?: TreeViewNode[];
|
|
10
15
|
/** Set the input's value. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import CodeBlock from './CodeBlock.svelte';
|
|
4
|
+
describe('CodeBlock.svelte', () => {
|
|
5
|
+
it('Renders with minimal props', async () => {
|
|
6
|
+
const { getByTestId } = render(CodeBlock, {
|
|
7
|
+
props: {
|
|
8
|
+
language: 'html',
|
|
9
|
+
code: '<p>Hello World</p>'
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
expect(getByTestId('codeblock')).toBeTruthy();
|
|
13
|
+
});
|
|
14
|
+
it('Renders with all props', async () => {
|
|
15
|
+
const { getByTestId } = render(CodeBlock, {
|
|
16
|
+
props: {
|
|
17
|
+
language: 'js',
|
|
18
|
+
code: `<div>Test</div>`,
|
|
19
|
+
background: 'bg-slate-800'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
expect(getByTestId('codeblock')).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -6,21 +6,23 @@ import { focusTrap } from "../../actions/FocusTrap/focusTrap.js";
|
|
|
6
6
|
import { getDrawerStore } from "./stores.js";
|
|
7
7
|
import { fade, fly } from "svelte/transition";
|
|
8
8
|
import { dynamicTransition } from "../../internal/transitions.js";
|
|
9
|
+
import { cubicIn } from "svelte/easing";
|
|
9
10
|
export let position = "left";
|
|
10
|
-
export let bgBackdrop = "bg-surface-backdrop-token";
|
|
11
|
-
export let blur = "";
|
|
12
|
-
export let padding = "";
|
|
13
11
|
export let bgDrawer = "bg-surface-100-800-token";
|
|
14
12
|
export let border = "";
|
|
15
13
|
export let rounded = "";
|
|
16
14
|
export let shadow = "shadow-xl";
|
|
17
15
|
export let width = "";
|
|
18
16
|
export let height = "";
|
|
17
|
+
export let bgBackdrop = "bg-surface-backdrop-token";
|
|
18
|
+
export let blur = "";
|
|
19
|
+
export let padding = "";
|
|
19
20
|
export let zIndex = "z-40";
|
|
20
21
|
export let regionBackdrop = "";
|
|
21
22
|
export let regionDrawer = "";
|
|
22
23
|
export let labelledby = "";
|
|
23
24
|
export let describedby = "";
|
|
25
|
+
export let duration = 200;
|
|
24
26
|
export let transitions = !$prefersReducedMotionStore;
|
|
25
27
|
export let opacityTransition = true;
|
|
26
28
|
const presets = {
|
|
@@ -47,10 +49,11 @@ const propDefaults = {
|
|
|
47
49
|
width,
|
|
48
50
|
height,
|
|
49
51
|
opacityTransition,
|
|
52
|
+
regionBackdrop,
|
|
53
|
+
regionDrawer,
|
|
50
54
|
labelledby,
|
|
51
55
|
describedby,
|
|
52
|
-
|
|
53
|
-
regionDrawer
|
|
56
|
+
duration
|
|
54
57
|
};
|
|
55
58
|
function applyPropSettings(settings) {
|
|
56
59
|
position = settings.position || propDefaults.position;
|
|
@@ -63,11 +66,12 @@ function applyPropSettings(settings) {
|
|
|
63
66
|
shadow = settings.shadow || propDefaults.shadow;
|
|
64
67
|
width = settings.width || propDefaults.width;
|
|
65
68
|
height = settings.height || propDefaults.height;
|
|
66
|
-
opacityTransition = settings.opacityTransition || propDefaults.opacityTransition;
|
|
67
69
|
regionBackdrop = settings.regionBackdrop || propDefaults.regionBackdrop;
|
|
68
70
|
regionDrawer = settings.regionDrawer || propDefaults.regionDrawer;
|
|
69
71
|
labelledby = settings.labelledby || propDefaults.labelledby;
|
|
70
72
|
describedby = settings.describedby || propDefaults.describedby;
|
|
73
|
+
opacityTransition = settings.opacityTransition || propDefaults.opacityTransition;
|
|
74
|
+
duration = settings.duration || propDefaults.duration;
|
|
71
75
|
}
|
|
72
76
|
function applyAnimationSettings() {
|
|
73
77
|
if (!BROWSER)
|
|
@@ -135,17 +139,17 @@ $:
|
|
|
135
139
|
class="drawer-backdrop {classesBackdrop}"
|
|
136
140
|
data-testid="drawer-backdrop"
|
|
137
141
|
on:mousedown={onDrawerInteraction}
|
|
138
|
-
on:touchstart
|
|
139
|
-
on:touchend
|
|
142
|
+
on:touchstart|passive
|
|
143
|
+
on:touchend|passive
|
|
140
144
|
on:keypress
|
|
141
145
|
in:dynamicTransition|local={{
|
|
142
146
|
transition: fade,
|
|
143
|
-
params: { duration
|
|
147
|
+
params: { duration },
|
|
144
148
|
enabled: transitions && opacityTransition
|
|
145
149
|
}}
|
|
146
150
|
out:dynamicTransition|local={{
|
|
147
151
|
transition: fade,
|
|
148
|
-
params: { duration
|
|
152
|
+
params: { duration },
|
|
149
153
|
enabled: transitions && opacityTransition
|
|
150
154
|
}}
|
|
151
155
|
use:focusTrap={true}
|
|
@@ -162,12 +166,12 @@ $:
|
|
|
162
166
|
aria-describedby={describedby}
|
|
163
167
|
in:dynamicTransition|local={{
|
|
164
168
|
transition: fly,
|
|
165
|
-
params: { x: anim.x, y: anim.y, duration
|
|
169
|
+
params: { x: anim.x, y: anim.y, duration, opacity: opacityTransition ? undefined : 1 },
|
|
166
170
|
enabled: transitions
|
|
167
171
|
}}
|
|
168
172
|
out:dynamicTransition|local={{
|
|
169
173
|
transition: fly,
|
|
170
|
-
params: { x: anim.x, y: anim.y, duration
|
|
174
|
+
params: { x: anim.x, y: anim.y, duration, opacity: opacityTransition ? undefined : 1, easing: cubicIn },
|
|
171
175
|
enabled: transitions
|
|
172
176
|
}}
|
|
173
177
|
>
|
|
@@ -4,12 +4,6 @@ declare const __propDef: {
|
|
|
4
4
|
[x: string]: any;
|
|
5
5
|
/** Set the anchor position.*/
|
|
6
6
|
position?: "left" | "top" | "right" | "bottom" | undefined;
|
|
7
|
-
/** Backdrop - Provide classes to set the backdrop background color*/
|
|
8
|
-
bgBackdrop?: string | undefined;
|
|
9
|
-
/** Backdrop - Provide classes to set the blur style.*/
|
|
10
|
-
blur?: string | undefined;
|
|
11
|
-
/** Backdrop - Provide classes to set padding.*/
|
|
12
|
-
padding?: string | undefined;
|
|
13
7
|
/** Drawer - Provide classes to set the drawer background color.*/
|
|
14
8
|
bgDrawer?: string | undefined;
|
|
15
9
|
/** Drawer - Provide classes to set border color.*/
|
|
@@ -22,7 +16,13 @@ declare const __propDef: {
|
|
|
22
16
|
width?: string | undefined;
|
|
23
17
|
/** Drawer - Provide classes to override the height.*/
|
|
24
18
|
height?: string | undefined;
|
|
25
|
-
/** Provide
|
|
19
|
+
/** Backdrop - Provide classes to set the backdrop background color*/
|
|
20
|
+
bgBackdrop?: string | undefined;
|
|
21
|
+
/** Backdrop - Provide classes to set the blur style.*/
|
|
22
|
+
blur?: string | undefined;
|
|
23
|
+
/** Backdrop - Provide classes to set padding.*/
|
|
24
|
+
padding?: string | undefined;
|
|
25
|
+
/** Backdrop - Provide a class to override the z-index*/
|
|
26
26
|
zIndex?: string | undefined;
|
|
27
27
|
/** Provide arbitrary classes to the backdrop region.*/
|
|
28
28
|
regionBackdrop?: string | undefined;
|
|
@@ -32,9 +32,11 @@ declare const __propDef: {
|
|
|
32
32
|
labelledby?: string | undefined;
|
|
33
33
|
/** Provide an ID of the element describing the drawer.*/
|
|
34
34
|
describedby?: string | undefined;
|
|
35
|
+
/** Set the transition duration in milliseconds.*/
|
|
36
|
+
duration?: number | undefined;
|
|
35
37
|
/** Enable/Disable transitions*/
|
|
36
38
|
transitions?: boolean | undefined;
|
|
37
|
-
/**
|
|
39
|
+
/** Enable/Disable opacity transition of Drawer*/
|
|
38
40
|
opacityTransition?: boolean | undefined;
|
|
39
41
|
};
|
|
40
42
|
events: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it } from 'vitest';
|
|
3
|
+
// import Drawer from './Drawer.svelte';
|
|
4
|
+
// import { drawerStore } from './stores.js';
|
|
5
|
+
describe('Drawer.svelte', () => {
|
|
6
|
+
it('Drawer hidden on load', async () => {
|
|
7
|
+
// const { getByTestId } = render(Drawer, {});
|
|
8
|
+
// FIXME: open drawer and verify elements exist
|
|
9
|
+
// drawerStore.open();
|
|
10
|
+
// expect(getByTestId('drawer-backdrop')).toBeFalsy();
|
|
11
|
+
// expect(getByTestId('drawer')).toBeFalsy();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -9,8 +9,6 @@ export interface DrawerSettings {
|
|
|
9
9
|
* @type {'left' | 'top' | 'right' | 'bottom'}
|
|
10
10
|
*/
|
|
11
11
|
position?: 'left' | 'top' | 'right' | 'bottom';
|
|
12
|
-
/** Define the Svelte transition animation duration.*/
|
|
13
|
-
duration?: number;
|
|
14
12
|
/** Backdrop - Provide classes to set the backdrop background color*/
|
|
15
13
|
bgBackdrop?: string;
|
|
16
14
|
/** Backdrop - Provide classes to set the blur style.*/
|
|
@@ -29,6 +27,8 @@ export interface DrawerSettings {
|
|
|
29
27
|
width?: string;
|
|
30
28
|
/** Drawer - Provide classes to override the height.*/
|
|
31
29
|
height?: string;
|
|
30
|
+
/** Define the Svelte transition animation duration.*/
|
|
31
|
+
duration?: number;
|
|
32
32
|
/** Drawer - Enable/Disable opacity transition */
|
|
33
33
|
opacityTransition?: boolean;
|
|
34
34
|
/** Provide arbitrary classes to the backdrop region. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import LightSwitch from './LightSwitch.svelte';
|
|
4
|
+
describe.skip('LightSwitch.svelte', () => {
|
|
5
|
+
it('Renders', async () => {
|
|
6
|
+
const { getByTestId } = render(LightSwitch);
|
|
7
|
+
expect(getByTestId('menu-wrapper')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
/*
|
|
10
|
+
TODO: additional test cases:
|
|
11
|
+
- default render state
|
|
12
|
+
- click to toggle
|
|
13
|
+
- off = light, on = dark (L<-->D)
|
|
14
|
+
- etc.
|
|
15
|
+
*/
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import ModalTest from './ModalTest.svelte';
|
|
4
|
+
// Modal Payloads
|
|
5
|
+
const modalAlert = {
|
|
6
|
+
type: 'alert',
|
|
7
|
+
title: 'Welcome to Skeleton.',
|
|
8
|
+
body: 'This is a standard alert modal.'
|
|
9
|
+
};
|
|
10
|
+
const modalConfirm = {
|
|
11
|
+
type: 'confirm',
|
|
12
|
+
title: 'Please Confirm',
|
|
13
|
+
body: 'Are you sure you wish to proceed?',
|
|
14
|
+
response: (r) => console.log(r)
|
|
15
|
+
};
|
|
16
|
+
const modalPrompt = {
|
|
17
|
+
type: 'prompt',
|
|
18
|
+
title: 'Enter Name',
|
|
19
|
+
body: 'Provide your first name in the field below.',
|
|
20
|
+
value: 'foobar',
|
|
21
|
+
response: (r) => console.log(r)
|
|
22
|
+
};
|
|
23
|
+
describe('Modal.svelte', () => {
|
|
24
|
+
it('Renders modal alert', async () => {
|
|
25
|
+
const { getByTestId } = render(ModalTest, { props: { modalSetting: modalAlert } });
|
|
26
|
+
expect(getByTestId('modal-backdrop')).toBeTruthy();
|
|
27
|
+
expect(getByTestId('modal')).toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
it('Renders modal confirm', async () => {
|
|
30
|
+
const { getByTestId } = render(ModalTest, { props: { modalSetting: modalConfirm } });
|
|
31
|
+
expect(getByTestId('modal-backdrop')).toBeTruthy();
|
|
32
|
+
expect(getByTestId('modal')).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
it('Renders modal prompt', async () => {
|
|
35
|
+
const { getByTestId } = render(ModalTest, { props: { modalSetting: modalPrompt } });
|
|
36
|
+
expect(getByTestId('modal-backdrop')).toBeTruthy();
|
|
37
|
+
expect(getByTestId('modal')).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { render } from '@testing-library/svelte';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import ToastTest from './ToastTest.svelte';
|
|
4
|
+
// Toast Payload
|
|
5
|
+
const toastMessage = {
|
|
6
|
+
message: 'Your Message Here',
|
|
7
|
+
autohide: true,
|
|
8
|
+
timeout: 5000,
|
|
9
|
+
action: {
|
|
10
|
+
label: 'Greeting',
|
|
11
|
+
response: () => alert('Hello, Skeleton')
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
describe('Toast.svelte', () => {
|
|
15
|
+
it('Renders modal alert', async () => {
|
|
16
|
+
const { getByTestId } = render(ToastTest, { props: { toastSettings: [toastMessage] } });
|
|
17
|
+
expect(getByTestId('toast')).toBeTruthy();
|
|
18
|
+
});
|
|
19
|
+
it('Renders only the configured max toasts at a time', async () => {
|
|
20
|
+
const { getAllByTestId } = render(ToastTest, { props: { max: 1, toastSettings: [{ message: '1' }, { message: '2' }] } });
|
|
21
|
+
expect(getAllByTestId('toast').length).toBe(1);
|
|
22
|
+
});
|
|
23
|
+
});
|