@skeletonlabs/skeleton 2.5.0 → 2.5.1-dev.d65b1ca8
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/components/Paginator/Paginator.svelte +1 -1
- package/dist/utilities/Popup/popup.js +3 -0
- package/package.json +1 -1
- package/dist/actions/Filters/filter.test.d.ts +0 -1
- package/dist/actions/Filters/filter.test.js +0 -36
- package/dist/components/Accordion/Accordion.test.d.ts +0 -1
- package/dist/components/Accordion/Accordion.test.js +0 -25
- package/dist/components/Accordion/AccordionItem.test.d.ts +0 -1
- package/dist/components/Accordion/AccordionItem.test.js +0 -22
- package/dist/components/AppBar/AppBar.test.d.ts +0 -1
- package/dist/components/AppBar/AppBar.test.js +0 -28
- package/dist/components/AppRail/AppRail.test.d.ts +0 -1
- package/dist/components/AppRail/AppRail.test.js +0 -28
- package/dist/components/AppRail/AppRailTile.test.d.ts +0 -1
- package/dist/components/AppRail/AppRailTile.test.js +0 -27
- package/dist/components/AppShell/AppShell.test.d.ts +0 -1
- package/dist/components/AppShell/AppShell.test.js +0 -23
- package/dist/components/Autocomplete/Autocomplete.test.d.ts +0 -1
- package/dist/components/Autocomplete/Autocomplete.test.js +0 -125
- package/dist/components/Avatar/Avatar.test.d.ts +0 -1
- package/dist/components/Avatar/Avatar.test.js +0 -35
- package/dist/components/ConicGradient/ConicGradient.test.d.ts +0 -1
- package/dist/components/ConicGradient/ConicGradient.test.js +0 -23
- package/dist/components/FileButton/FileButton.test.d.ts +0 -1
- package/dist/components/FileButton/FileButton.test.js +0 -29
- package/dist/components/FileDropzone/FileDropzone.test.d.ts +0 -1
- package/dist/components/FileDropzone/FileDropzone.test.js +0 -29
- package/dist/components/ListBox/ListBox.test.d.ts +0 -1
- package/dist/components/ListBox/ListBox.test.js +0 -42
- package/dist/components/ListBox/ListBoxItem.test.d.ts +0 -1
- package/dist/components/ListBox/ListBoxItem.test.js +0 -29
- package/dist/components/Paginator/Paginator.test.d.ts +0 -1
- package/dist/components/Paginator/Paginator.test.js +0 -26
- package/dist/components/ProgressBar/ProgressBar.test.d.ts +0 -1
- package/dist/components/ProgressBar/ProgressBar.test.js +0 -24
- package/dist/components/ProgressRadial/ProgressRadial.test.d.ts +0 -1
- package/dist/components/ProgressRadial/ProgressRadial.test.js +0 -24
- package/dist/components/Radio/RadioGroup.test.d.ts +0 -1
- package/dist/components/Radio/RadioGroup.test.js +0 -27
- package/dist/components/Radio/RadioItem.test.d.ts +0 -1
- package/dist/components/Radio/RadioItem.test.js +0 -24
- package/dist/components/RangeSlider/RangeSlider.test.d.ts +0 -1
- package/dist/components/RangeSlider/RangeSlider.test.js +0 -38
- package/dist/components/Ratings/Ratings.test.d.ts +0 -1
- package/dist/components/Ratings/Ratings.test.js +0 -20
- package/dist/components/SlideToggle/SlideToggle.test.d.ts +0 -1
- package/dist/components/SlideToggle/SlideToggle.test.js +0 -21
- package/dist/components/Stepper/Step.test.d.ts +0 -1
- package/dist/components/Stepper/Step.test.js +0 -21
- package/dist/components/Stepper/Stepper.test.d.ts +0 -1
- package/dist/components/Stepper/Stepper.test.js +0 -26
- package/dist/components/Tab/Tab.test.d.ts +0 -1
- package/dist/components/Tab/Tab.test.js +0 -30
- package/dist/components/Tab/TabGroup.test.d.ts +0 -1
- package/dist/components/Tab/TabGroup.test.js +0 -26
- package/dist/components/TreeView/TreeView.test.d.ts +0 -1
- package/dist/components/TreeView/TreeView.test.js +0 -28
- package/dist/components/TreeView/TreeViewItem.test.d.ts +0 -1
- package/dist/components/TreeView/TreeViewItem.test.js +0 -26
- package/dist/utilities/CodeBlock/CodeBlock.test.d.ts +0 -1
- package/dist/utilities/CodeBlock/CodeBlock.test.js +0 -24
- package/dist/utilities/Drawer/Drawer.test.d.ts +0 -1
- package/dist/utilities/Drawer/Drawer.test.js +0 -13
- package/dist/utilities/LightSwitch/LightSwitch.test.d.ts +0 -1
- package/dist/utilities/LightSwitch/LightSwitch.test.js +0 -16
- package/dist/utilities/Modal/Modal.test.d.ts +0 -1
- package/dist/utilities/Modal/Modal.test.js +0 -39
- package/dist/utilities/Toast/Toast.test.d.ts +0 -1
- package/dist/utilities/Toast/Toast.test.js +0 -23
|
@@ -153,7 +153,7 @@ $:
|
|
|
153
153
|
{:else}
|
|
154
154
|
<!-- Numeric Row -->
|
|
155
155
|
{#each controlPages as page}
|
|
156
|
-
<button type="button" class="{buttonClasses} {classesButtonActive(page)}" on:click={() => gotoPage(page)}>
|
|
156
|
+
<button type="button" {disabled} class="{buttonClasses} {classesButtonActive(page)}" on:click={() => gotoPage(page)}>
|
|
157
157
|
{page >= 0 ? page + 1 : '...'}
|
|
158
158
|
</button>
|
|
159
159
|
{/each}
|
|
@@ -157,6 +157,9 @@ export function popup(triggerNode, args) {
|
|
|
157
157
|
}
|
|
158
158
|
// Handle Close Query State
|
|
159
159
|
const closeQueryString = args.closeQuery === undefined ? 'a[href], button' : args.closeQuery;
|
|
160
|
+
// Return if no closeQuery is provided
|
|
161
|
+
if (closeQueryString === '')
|
|
162
|
+
return;
|
|
160
163
|
const closableMenuElements = elemPopup?.querySelectorAll(closeQueryString);
|
|
161
164
|
closableMenuElements?.forEach((elem) => {
|
|
162
165
|
if (elem.contains(event.target))
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
// Action
|
|
4
|
-
import { filter } from './filter.js';
|
|
5
|
-
// SVG Filters
|
|
6
|
-
import Emerald from './svg-filters/Emerald.svelte';
|
|
7
|
-
import BlueNight from './svg-filters/BlueNight.svelte';
|
|
8
|
-
import XPro from './svg-filters/XPro.svelte';
|
|
9
|
-
import Summer84 from './svg-filters/Summer84.svelte';
|
|
10
|
-
import Rustic from './svg-filters/Rustic.svelte';
|
|
11
|
-
import Apollo from './svg-filters/Apollo.svelte';
|
|
12
|
-
import GreenFall from './svg-filters/GreenFall.svelte';
|
|
13
|
-
import Noir from './svg-filters/Noir.svelte';
|
|
14
|
-
import NoirLight from './svg-filters/NoirLight.svelte';
|
|
15
|
-
describe('Actions: Filter', () => {
|
|
16
|
-
it('Tests all SVGs have class of "filter"', async () => {
|
|
17
|
-
render(Emerald);
|
|
18
|
-
render(BlueNight);
|
|
19
|
-
render(XPro);
|
|
20
|
-
render(Summer84);
|
|
21
|
-
render(Rustic);
|
|
22
|
-
render(Apollo);
|
|
23
|
-
render(GreenFall);
|
|
24
|
-
render(NoirLight);
|
|
25
|
-
render(Noir);
|
|
26
|
-
const elements = document.getElementsByClassName('filter');
|
|
27
|
-
for (const element of elements) {
|
|
28
|
-
expect(element.getAttribute('class')?.includes('filter'));
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
it('Test the node gets the filter url', async () => {
|
|
32
|
-
const elem = document.createElement('div');
|
|
33
|
-
filter(elem, 'XPro');
|
|
34
|
-
expect(elem.getAttribute('style')?.includes('filter: url("#Emerald")'));
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import Accordion from './Accordion.svelte';
|
|
4
|
-
describe('Accordion.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(Accordion);
|
|
7
|
-
expect(getByTestId('accordion')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(Accordion, {
|
|
11
|
-
props: {
|
|
12
|
-
autocollapse: true,
|
|
13
|
-
spacing: 'space-y-1',
|
|
14
|
-
padding: 'py-2 px-4',
|
|
15
|
-
hover: 'hover:bg-primary-hover-token',
|
|
16
|
-
rounded: 'rounded-container-token',
|
|
17
|
-
regionControl: '',
|
|
18
|
-
regionPanel: 'space-y-4',
|
|
19
|
-
regionCaret: ''
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
expect(getByTestId('accordion')).toBeTruthy();
|
|
23
|
-
expect(getByTestId('accordion').className).to.contain('space-y-1');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import AccordionItem from './AccordionItem.svelte';
|
|
4
|
-
describe('AccordionItem.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(AccordionItem);
|
|
7
|
-
expect(getByTestId('accordion-item')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(AccordionItem, {
|
|
11
|
-
open: true,
|
|
12
|
-
padding: 'py-2 px-4',
|
|
13
|
-
hover: 'hover:bg-primary-hover-token',
|
|
14
|
-
rounded: 'rounded-container-token',
|
|
15
|
-
regionControl: '',
|
|
16
|
-
regionPanel: 'space-y-4',
|
|
17
|
-
regionCaret: ''
|
|
18
|
-
});
|
|
19
|
-
expect(getByTestId('accordion-item')).toBeTruthy();
|
|
20
|
-
expect(getByTestId('accordion-item').querySelector('.accordion-control')?.className).to.contain('py-2 px-4');
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import AppBar from './AppBar.svelte';
|
|
4
|
-
describe('AppBar.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(AppBar);
|
|
7
|
-
expect(getByTestId('app-bar')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(AppBar, {
|
|
11
|
-
props: {
|
|
12
|
-
background: 'bg-primary-500',
|
|
13
|
-
border: 'border border-secondary-500',
|
|
14
|
-
padding: 'p-4',
|
|
15
|
-
shadow: 'shadow',
|
|
16
|
-
space: 'space-x-2',
|
|
17
|
-
// Slots
|
|
18
|
-
slotLead: 'bg-red-500',
|
|
19
|
-
slotCenter: 'bg-green-500',
|
|
20
|
-
slotTrail: 'bg-blue-500',
|
|
21
|
-
// a11y
|
|
22
|
-
label: 'TestAppShell',
|
|
23
|
-
labelledby: 'TestLabelAppShell'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
expect(getByTestId('app-bar')).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import AppRail from './AppRail.svelte';
|
|
4
|
-
import { readable } from 'svelte/store';
|
|
5
|
-
describe('AppRail.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', async () => {
|
|
7
|
-
const { getByTestId } = render(AppRail);
|
|
8
|
-
expect(getByTestId('app-rail')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with all props', async () => {
|
|
11
|
-
const { getByTestId } = render(AppRail, {
|
|
12
|
-
props: {
|
|
13
|
-
selected: readable('/'),
|
|
14
|
-
background: 'bg-primary-500',
|
|
15
|
-
border: 'border-primary-500',
|
|
16
|
-
active: 'bg-primary-500',
|
|
17
|
-
hover: 'bg-primary-500',
|
|
18
|
-
width: 'w-20',
|
|
19
|
-
height: 'h-20',
|
|
20
|
-
gap: 'gap-0',
|
|
21
|
-
regionLead: 'p-1',
|
|
22
|
-
regionDefault: 'p-1',
|
|
23
|
-
regionTrail: 'p-1'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
expect(getByTestId('app-rail')).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import AppRailTile from './AppRailTile.svelte';
|
|
4
|
-
import { readable } from 'svelte/store';
|
|
5
|
-
describe('AppRailTile.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', async () => {
|
|
7
|
-
const { getByTestId } = render(AppRailTile);
|
|
8
|
-
expect(getByTestId('app-rail-tile')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with all props', async () => {
|
|
11
|
-
const { getByTestId } = render(AppRailTile, {
|
|
12
|
-
props: {
|
|
13
|
-
value: 'TestAppRailTile',
|
|
14
|
-
tag: 'button',
|
|
15
|
-
label: 'TestAppRailTile',
|
|
16
|
-
regionIcon: 'TestAppRailTile',
|
|
17
|
-
regionLabel: 'TestAppRailTile',
|
|
18
|
-
selected: readable('/'),
|
|
19
|
-
active: 'bg-primary-500',
|
|
20
|
-
hover: 'bg-primary-500',
|
|
21
|
-
group: 'testGroup',
|
|
22
|
-
name: 'test'
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
expect(getByTestId('app-rail-tile')).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import AppShell from './AppShell.svelte';
|
|
4
|
-
describe('AppShell.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(AppShell);
|
|
7
|
-
expect(getByTestId('app-shell')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(AppShell, {
|
|
11
|
-
props: {
|
|
12
|
-
slotHeader: 'bg-red-500',
|
|
13
|
-
slotSidebarLeft: 'w-auto',
|
|
14
|
-
slotSidebarRight: 'w-auto',
|
|
15
|
-
slotPageHeader: 'bg-green-500',
|
|
16
|
-
slotPageContent: 'bg-blue-500',
|
|
17
|
-
slotPageFooter: 'bg-yellow-500',
|
|
18
|
-
slotFooter: 'bg-purple-500'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
expect(getByTestId('app-shell')).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import Autocomplete from './Autocomplete.svelte';
|
|
3
|
-
import { render } from '@testing-library/svelte';
|
|
4
|
-
// keeping this as an array of `as const`s gives us autocompletion, and type safety
|
|
5
|
-
const options = [
|
|
6
|
-
{ label: 'Vanilla', value: 'vanilla', keywords: 'plain, basic', meta: { healthy: false } },
|
|
7
|
-
{ label: 'Chocolate', value: 'chocolate', keywords: 'dark, white', meta: { healthy: false } },
|
|
8
|
-
{ label: 'Strawberry', value: 'strawberry', keywords: 'fruit', meta: { healthy: true } },
|
|
9
|
-
{ label: 'Neapolitan', value: 'neapolitan', keywords: 'mix, strawberry, chocolate, vanilla', meta: { healthy: false } },
|
|
10
|
-
{ label: 'Pineapple', value: 'pineapple', keywords: 'fruit', meta: { healthy: true } },
|
|
11
|
-
{ label: 'Peach', value: 'peach', keywords: 'fruit', meta: { healthy: true } }
|
|
12
|
-
];
|
|
13
|
-
// NB: be very careful picking options. Make sure none of the search terms match the keywords of unintended options.
|
|
14
|
-
describe('Autocomplete.svelte', () => {
|
|
15
|
-
it('Shows all the options when no search term is provided', () => {
|
|
16
|
-
const { getByText } = render(Autocomplete, { props: { options, input: '' } });
|
|
17
|
-
options.forEach((option) => {
|
|
18
|
-
expect(getByText(option.label)).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
it('Shows only the options that match the search term', () => {
|
|
22
|
-
const matchingOptions = ['Neapolitan', 'Pineapple'];
|
|
23
|
-
const notMatchingOptions = options.filter((option) => !matchingOptions.includes(option.label));
|
|
24
|
-
const { getByText, queryByText } = render(Autocomplete, { props: { options, input: 'ne' } });
|
|
25
|
-
matchingOptions.forEach((option) => {
|
|
26
|
-
expect(getByText(option)).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
notMatchingOptions.forEach((option) => {
|
|
29
|
-
expect(queryByText(option.label)).toBeFalsy();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it('Searches in keywords', () => {
|
|
33
|
-
const matchingOptions = ['Strawberry', 'Peach', 'Pineapple'];
|
|
34
|
-
const notMatchingOptions = options.filter((option) => !matchingOptions.includes(option.label));
|
|
35
|
-
const { getByText, queryByText } = render(Autocomplete, { props: { options, input: 'fruit' } });
|
|
36
|
-
matchingOptions.forEach((option) => {
|
|
37
|
-
expect(getByText(option)).toBeTruthy();
|
|
38
|
-
});
|
|
39
|
-
notMatchingOptions.forEach((option) => {
|
|
40
|
-
expect(queryByText(option.label)).toBeFalsy();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
it('Shows a message when no options match the search term', () => {
|
|
44
|
-
const { getByText, rerender } = render(Autocomplete, { props: { options, input: 'nonexistent' } });
|
|
45
|
-
expect(getByText('No Results Found.')).toBeTruthy();
|
|
46
|
-
// ensures custom message is set
|
|
47
|
-
rerender({ options, input: 'nonexistent', emptyState: 'custom message' });
|
|
48
|
-
expect(getByText('custom message')).toBeTruthy();
|
|
49
|
-
});
|
|
50
|
-
it('Fires the selection event when an option is selected', () => {
|
|
51
|
-
let selectedOption;
|
|
52
|
-
const selectionHandler = vi.fn((e) => (selectedOption = e.detail));
|
|
53
|
-
const { getByText, component } = render(Autocomplete, {
|
|
54
|
-
props: { options, input: 'ne' }
|
|
55
|
-
});
|
|
56
|
-
component.$on('selection', selectionHandler);
|
|
57
|
-
getByText('Neapolitan').click();
|
|
58
|
-
expect(selectionHandler).toHaveBeenCalled();
|
|
59
|
-
expect(selectedOption).toEqual(options.find((o) => o.label === 'Neapolitan'));
|
|
60
|
-
});
|
|
61
|
-
// TODO: fix these tests
|
|
62
|
-
// describe('allowlist', () => {
|
|
63
|
-
// it('only shows items in the allowlist when no search term is present', () => {
|
|
64
|
-
// // doesn't include 'pineapple'
|
|
65
|
-
// const allowlist: Value[] = ['neapolitan', 'chocolate', 'peach', 'strawberry', 'vanilla'];
|
|
66
|
-
// const { getByText, queryByText } = render(Autocomplete, { props: { options, input: '', allowlist } });
|
|
67
|
-
// options.forEach((option) => {
|
|
68
|
-
// if (!allowlist.includes(option.value)) {
|
|
69
|
-
// expect(queryByText(option.label)).toBeFalsy();
|
|
70
|
-
// } else {
|
|
71
|
-
// expect(getByText(option.label)).toBeTruthy();
|
|
72
|
-
// }
|
|
73
|
-
// });
|
|
74
|
-
// });
|
|
75
|
-
// it('only shows items in the allowlist when searching', () => {
|
|
76
|
-
// // doesn't include 'pineapple'
|
|
77
|
-
// const allowlist: Value[] = ['neapolitan', 'chocolate', 'peach', 'strawberry', 'vanilla'];
|
|
78
|
-
// const { getByText, queryByText } = render(Autocomplete, { props: { options, input: 'ne', allowlist } });
|
|
79
|
-
// const matchingOptions: Label[] = ['Neapolitan'];
|
|
80
|
-
// const notMatchingOptions = options.filter((option) => !matchingOptions.includes(option.label));
|
|
81
|
-
// matchingOptions.forEach((option) => {
|
|
82
|
-
// expect(getByText(option)).toBeTruthy();
|
|
83
|
-
// });
|
|
84
|
-
// notMatchingOptions.forEach((option) => {
|
|
85
|
-
// expect(queryByText(option.label)).toBeFalsy();
|
|
86
|
-
// });
|
|
87
|
-
// });
|
|
88
|
-
// it('shows the empty message if the only matching elements are not in the allowlist', () => {
|
|
89
|
-
// const allowlist: Value[] = ['neapolitan', 'chocolate', 'peach', 'strawberry', 'vanilla'];
|
|
90
|
-
// const { queryByText } = render(Autocomplete, { props: { options, input: 'pineapple', allowlist } });
|
|
91
|
-
// expect(queryByText('No Results Found.')).toBeTruthy();
|
|
92
|
-
// });
|
|
93
|
-
// });
|
|
94
|
-
describe('denylist', () => {
|
|
95
|
-
it('does not show items in the denylist when no search term is present', () => {
|
|
96
|
-
const denylist = ['pineapple'];
|
|
97
|
-
const { getByText, queryByText } = render(Autocomplete, { props: { options, input: '', denylist } });
|
|
98
|
-
options.forEach((option) => {
|
|
99
|
-
if (denylist.includes(option.value)) {
|
|
100
|
-
expect(queryByText(option.label)).toBeFalsy();
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
expect(getByText(option.label)).toBeTruthy();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
it('does not show items in the denylist when searching', () => {
|
|
108
|
-
const denylist = ['pineapple'];
|
|
109
|
-
const { getByText, queryByText } = render(Autocomplete, { props: { options, input: 'ne', denylist } });
|
|
110
|
-
const matchingOptions = ['Neapolitan'];
|
|
111
|
-
const notMatchingOptions = options.filter((option) => !matchingOptions.includes(option.label));
|
|
112
|
-
matchingOptions.forEach((option) => {
|
|
113
|
-
expect(getByText(option)).toBeTruthy();
|
|
114
|
-
});
|
|
115
|
-
notMatchingOptions.forEach((option) => {
|
|
116
|
-
expect(queryByText(option.label)).toBeFalsy();
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
it('shows the empty message if the only matching options are in the denylist', () => {
|
|
120
|
-
const denylist = ['pineapple'];
|
|
121
|
-
const { queryByText } = render(Autocomplete, { props: { options, input: 'pineapple', denylist } });
|
|
122
|
-
expect(queryByText('No Results Found.')).toBeTruthy();
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import Avatar from './Avatar.svelte';
|
|
4
|
-
const imgTextSrc = 'https://i.pravatar.cc/512?img=48';
|
|
5
|
-
describe('Avatar.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', async () => {
|
|
7
|
-
const { getByTestId } = render(Avatar);
|
|
8
|
-
expect(getByTestId('avatar')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with all props', async () => {
|
|
11
|
-
const { getByTestId } = render(Avatar, {
|
|
12
|
-
props: {
|
|
13
|
-
background: 'bg-surface-500',
|
|
14
|
-
width: 'w-12',
|
|
15
|
-
border: '',
|
|
16
|
-
rounded: 'rounded-full',
|
|
17
|
-
shadow: 'shadow-xl',
|
|
18
|
-
// Props (initials)
|
|
19
|
-
initials: 'AB',
|
|
20
|
-
text: 'text-xl',
|
|
21
|
-
color: 'text-white'
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(getByTestId('avatar')).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
it('Image shown when src prop set', async () => {
|
|
27
|
-
const { getByTestId } = render(Avatar, { props: { src: imgTextSrc } });
|
|
28
|
-
const elemImage = getByTestId('avatar').querySelector('.avatar-image');
|
|
29
|
-
expect(elemImage?.src).to.eq(imgTextSrc);
|
|
30
|
-
});
|
|
31
|
-
it('Initials shown when no image source provided', async () => {
|
|
32
|
-
const { getByTestId } = render(Avatar);
|
|
33
|
-
expect(getByTestId('avatar').querySelector('.avatar-initials')?.textContent).eq('AB');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import ConicGradient from './ConicGradient.svelte';
|
|
4
|
-
describe('ConicGradient.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(ConicGradient);
|
|
7
|
-
expect(getByTestId('conic-gradient')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with props', () => {
|
|
10
|
-
const { getByTestId } = render(ConicGradient, {
|
|
11
|
-
props: {
|
|
12
|
-
data: [
|
|
13
|
-
{ label: 'Emerald', color: ['emerald', 500], start: 0, end: 33 },
|
|
14
|
-
{ label: 'Indigo', color: ['indigo', 500], start: 33, end: 66 },
|
|
15
|
-
{ label: 'Rose', color: ['rose', 500], start: 66, end: 100 }
|
|
16
|
-
],
|
|
17
|
-
legend: true,
|
|
18
|
-
width: 'w-8'
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
expect(getByTestId('conic-gradient')).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import FileButton from './FileButton.svelte';
|
|
4
|
-
describe('FileButton.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(FileButton, { props: { name: 'testName' } });
|
|
7
|
-
expect(getByTestId('file-button')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
// Create Mock FileList
|
|
11
|
-
// Reference: https://dev.to/akirakashihara/how-to-mock-filelist-on-vitest-or-jest-4494
|
|
12
|
-
// const file = new File([`foo`], `foo.txt`, { type: `text/plain` });
|
|
13
|
-
// const input = document.createElement(`input`);
|
|
14
|
-
// input.setAttribute(`type`, `file`);
|
|
15
|
-
// input.setAttribute(`name`, `file-upload`);
|
|
16
|
-
// const mockFileList = Object.create(input.files);
|
|
17
|
-
// mockFileList[0] = file;
|
|
18
|
-
// ---
|
|
19
|
-
const { getByTestId } = render(FileButton, {
|
|
20
|
-
props: {
|
|
21
|
-
// files: mockFileList,
|
|
22
|
-
name: 'testFileButtonInput',
|
|
23
|
-
accept: 'image/*',
|
|
24
|
-
multiple: false
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
expect(getByTestId('file-button')).toBeTruthy();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import FileDropzone from './FileDropzone.svelte';
|
|
4
|
-
describe('FileDropzone.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(FileDropzone, { props: { name: 'testName' } });
|
|
7
|
-
expect(getByTestId('file-dropzone')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
// Create Mock FileList
|
|
11
|
-
// Reference: https://dev.to/akirakashihara/how-to-mock-filelist-on-vitest-or-jest-4494
|
|
12
|
-
// const file = new File([`foo`], `foo.txt`, { type: `text/plain` });
|
|
13
|
-
// const input = document.createElement(`input`);
|
|
14
|
-
// input.setAttribute(`type`, `file`);
|
|
15
|
-
// input.setAttribute(`name`, `file-upload`);
|
|
16
|
-
// const mockFileList = Object.create(input.files);
|
|
17
|
-
// mockFileList[0] = file;
|
|
18
|
-
// ---
|
|
19
|
-
const { getByTestId } = render(FileDropzone, {
|
|
20
|
-
props: {
|
|
21
|
-
// files: mockFileList,
|
|
22
|
-
name: 'testFileDropzoneInput',
|
|
23
|
-
accept: 'image/*',
|
|
24
|
-
multiple: false
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
expect(getByTestId('file-dropzone')).toBeTruthy();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { writable } from 'svelte/store';
|
|
4
|
-
import ListBox from './ListBox.svelte';
|
|
5
|
-
describe('ListBox.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', async () => {
|
|
7
|
-
const { getByTestId } = render(ListBox);
|
|
8
|
-
expect(getByTestId('listbox')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with all props', async () => {
|
|
11
|
-
const { getByTestId } = render(ListBox, {
|
|
12
|
-
props: {
|
|
13
|
-
selected: writable('foobar'),
|
|
14
|
-
space: 'space-y-1',
|
|
15
|
-
height: 'h-auto',
|
|
16
|
-
// Props (Item)
|
|
17
|
-
accent: '!bg-primary-500',
|
|
18
|
-
padding: 'px-4 py-3',
|
|
19
|
-
rounded: 'rounded',
|
|
20
|
-
// Props (regions)
|
|
21
|
-
regionLabel: 'bg-red-500',
|
|
22
|
-
regionList: 'bg-green-500',
|
|
23
|
-
// Props (a11y)
|
|
24
|
-
label: 'testList1',
|
|
25
|
-
labelId: 'testListId1'
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
expect(getByTestId('listbox')).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
it('Renders listbox, single value', async () => {
|
|
31
|
-
const { getByTestId } = render(ListBox, { props: { tag: 'nav', selected: writable('foobar') } });
|
|
32
|
-
const element = getByTestId('listbox');
|
|
33
|
-
expect(element).toBeTruthy();
|
|
34
|
-
expect(element.tagName).eq('DIV');
|
|
35
|
-
});
|
|
36
|
-
it('Renders listbox, multiple values', async () => {
|
|
37
|
-
const { getByTestId } = render(ListBox, { props: { tag: 'nav', selected: writable(['foo', 'bar']) } });
|
|
38
|
-
const element = getByTestId('listbox');
|
|
39
|
-
expect(element).toBeTruthy();
|
|
40
|
-
expect(element.tagName).eq('DIV');
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import ListBoxItem from './ListBoxItem.svelte';
|
|
4
|
-
describe('ListBoxItem.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(ListBoxItem, {
|
|
7
|
-
props: {
|
|
8
|
-
group: 'testGroup',
|
|
9
|
-
name: 'testName',
|
|
10
|
-
value: 'testValue'
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
const element = getByTestId('listbox-item');
|
|
14
|
-
expect(element).toBeTruthy();
|
|
15
|
-
expect(element.tagName).eq('DIV');
|
|
16
|
-
});
|
|
17
|
-
// TODO: we need to define the `value` prop here, not sure the syntax
|
|
18
|
-
it('Renders <nav> selection list item, single value', async () => {
|
|
19
|
-
const { getByTestId } = render(ListBoxItem, {
|
|
20
|
-
props: {
|
|
21
|
-
group: 'testGroup',
|
|
22
|
-
name: 'testName',
|
|
23
|
-
value: 'testValue'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const element = getByTestId('listbox-item');
|
|
27
|
-
expect(element).toBeTruthy();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import Paginator from './Paginator.svelte';
|
|
4
|
-
describe('Paginator.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(Paginator);
|
|
7
|
-
expect(getByTestId('paginator')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(Paginator, {
|
|
11
|
-
props: {
|
|
12
|
-
offset: 1,
|
|
13
|
-
limit: 50,
|
|
14
|
-
size: 100,
|
|
15
|
-
amounts: [1, 5, 10, 50, 100],
|
|
16
|
-
// ---
|
|
17
|
-
justify: 'justify-between',
|
|
18
|
-
text: 'text-xs',
|
|
19
|
-
select: 'bg-primary-500',
|
|
20
|
-
// ---
|
|
21
|
-
buttons: { variant: 'filled-primary' }
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(getByTestId('paginator')).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import ProgressBar from './ProgressBar.svelte';
|
|
4
|
-
describe('ProgressBar.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(ProgressBar);
|
|
7
|
-
expect(getByTestId('progress-bar')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', () => {
|
|
10
|
-
const { getByTestId } = render(ProgressBar, {
|
|
11
|
-
props: {
|
|
12
|
-
label: 'Test',
|
|
13
|
-
min: 10,
|
|
14
|
-
value: 50,
|
|
15
|
-
max: 100,
|
|
16
|
-
height: 'h-1',
|
|
17
|
-
rounded: 'rounded-none',
|
|
18
|
-
meter: 'bg-warning-500',
|
|
19
|
-
track: 'bg-warning-500/30'
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
expect(getByTestId('progress-bar')).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import ProgressRadial from './ProgressRadial.svelte';
|
|
4
|
-
describe('ProgressRadial.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(ProgressRadial);
|
|
7
|
-
expect(getByTestId('progress-radial')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', () => {
|
|
10
|
-
const { getByTestId } = render(ProgressRadial, {
|
|
11
|
-
props: {
|
|
12
|
-
value: 50,
|
|
13
|
-
stroke: 20,
|
|
14
|
-
track: 'stroke-surface-300 dark:stroke-surface-700',
|
|
15
|
-
meter: 'stroke-black dark:stroke-white',
|
|
16
|
-
color: 'fill-black dark:fill-white',
|
|
17
|
-
font: 56,
|
|
18
|
-
label: 'testProgressRadial1',
|
|
19
|
-
roundedLineCap: true
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
expect(getByTestId('progress-radial')).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import RadioGroup from './RadioGroup.svelte';
|
|
4
|
-
describe('RadioGroup.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(RadioGroup, {
|
|
7
|
-
props: {}
|
|
8
|
-
});
|
|
9
|
-
expect(getByTestId('radio-group')).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
it('Renders with all props', () => {
|
|
12
|
-
const { getByTestId } = render(RadioGroup, {
|
|
13
|
-
props: {
|
|
14
|
-
display: 'inline-flex',
|
|
15
|
-
background: 'bg-surface-300 dark:bg-surface-700',
|
|
16
|
-
hover: 'hover:bg-primary-500/10',
|
|
17
|
-
accent: 'bg-primary-500 !text-white',
|
|
18
|
-
color: 'text-white',
|
|
19
|
-
fill: 'fill-white',
|
|
20
|
-
rounded: 'rounded',
|
|
21
|
-
// A11y
|
|
22
|
-
label: 'testRadioGroup'
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
expect(getByTestId('radio-group')).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import RadioItem from './RadioItem.svelte';
|
|
4
|
-
describe('RadioItem.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(RadioItem, {
|
|
7
|
-
group: 'testGroup',
|
|
8
|
-
name: 'testName',
|
|
9
|
-
value: 'testValue'
|
|
10
|
-
});
|
|
11
|
-
expect(getByTestId('radio-item')).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
it('Renders with all props', () => {
|
|
14
|
-
const { getByTestId } = render(RadioItem, {
|
|
15
|
-
props: {
|
|
16
|
-
group: 'testGroup',
|
|
17
|
-
name: 'testName',
|
|
18
|
-
value: 'testValue',
|
|
19
|
-
label: 'testLabel'
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
expect(getByTestId('radio-item')).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import RangeSlider from './RangeSlider.svelte';
|
|
4
|
-
describe('RangeSlider.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(RangeSlider, { props: { name: 'testRangeSlider' } });
|
|
7
|
-
expect(getByTestId('range-slider')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(RangeSlider, {
|
|
11
|
-
props: {
|
|
12
|
-
min: 0,
|
|
13
|
-
max: 20,
|
|
14
|
-
step: 5,
|
|
15
|
-
value: 10,
|
|
16
|
-
ticked: true,
|
|
17
|
-
accent: 'bg-primary-500',
|
|
18
|
-
// a11y
|
|
19
|
-
id: 'testRangeSlider1',
|
|
20
|
-
name: 'testRangeSlider1',
|
|
21
|
-
label: 'testRangeSliderLabel1'
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(getByTestId('range-slider')).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
it('Ticks enabled', async () => {
|
|
27
|
-
const { getByTestId } = render(RangeSlider, {
|
|
28
|
-
props: { name: 'testName', ticked: true }
|
|
29
|
-
});
|
|
30
|
-
expect(getByTestId('range-slider').querySelector('datalist')).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
it('Disabled state', async () => {
|
|
33
|
-
const { getByTestId } = render(RangeSlider, {
|
|
34
|
-
props: { name: 'testName', disabled: true }
|
|
35
|
-
});
|
|
36
|
-
expect(getByTestId('range-slider').querySelector('input')?.disabled).eq(true);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import Ratings from './Ratings.svelte';
|
|
4
|
-
describe('RatingBar.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(Ratings);
|
|
7
|
-
expect(getByTestId('rating-bar')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', () => {
|
|
10
|
-
const { getByTestId } = render(Ratings, {
|
|
11
|
-
props: {
|
|
12
|
-
max: 10,
|
|
13
|
-
value: 5.5,
|
|
14
|
-
justify: 'justify-center',
|
|
15
|
-
spacing: 'space-x-4'
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
expect(getByTestId('rating-bar')).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import SliderToggle from './SlideToggle.svelte';
|
|
4
|
-
describe('SliderToggle.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(SliderToggle, { props: { name: 'testName' } });
|
|
7
|
-
expect(getByTestId('slide-toggle')).toBeTruthy();
|
|
8
|
-
});
|
|
9
|
-
it('Renders with all props', async () => {
|
|
10
|
-
const { getByTestId } = render(SliderToggle, {
|
|
11
|
-
props: {
|
|
12
|
-
name: 'testName',
|
|
13
|
-
checked: true,
|
|
14
|
-
accent: 'bg-primary-500',
|
|
15
|
-
size: 'lg',
|
|
16
|
-
label: 'testSlideToggle1'
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
expect(getByTestId('slide-toggle')).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { writable } from 'svelte/store';
|
|
4
|
-
import Step from './Step.svelte';
|
|
5
|
-
const mockState = writable({ current: 1, total: 1 }); // NOTE: current/total must match!
|
|
6
|
-
describe('Step.svelte', () => {
|
|
7
|
-
it('Renders with mininal props', async () => {
|
|
8
|
-
const { getByTestId } = render(Step, { props: { state: mockState, index: 0 } });
|
|
9
|
-
expect(getByTestId('step')).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
it('Renders with all props', () => {
|
|
12
|
-
const { getByTestId } = render(Step, {
|
|
13
|
-
props: {
|
|
14
|
-
state: mockState,
|
|
15
|
-
index: 0,
|
|
16
|
-
locked: false
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
expect(getByTestId('step')).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { writable } from 'svelte/store';
|
|
4
|
-
import Stepper from './Stepper.svelte';
|
|
5
|
-
describe('Stepper.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', () => {
|
|
7
|
-
const { getByTestId } = render(Stepper);
|
|
8
|
-
expect(getByTestId('stepper')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with all props', () => {
|
|
11
|
-
const { getByTestId } = render(Stepper, {
|
|
12
|
-
props: {
|
|
13
|
-
active: writable(0),
|
|
14
|
-
length: 0,
|
|
15
|
-
// Props (timeline)
|
|
16
|
-
color: 'text-white',
|
|
17
|
-
background: 'bg-secondary-500 text-white',
|
|
18
|
-
// Props (buttons)
|
|
19
|
-
buttonBack: {},
|
|
20
|
-
buttonNext: {},
|
|
21
|
-
buttonComplete: {}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(getByTestId('stepper')).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import Tab from './Tab.svelte';
|
|
4
|
-
describe('Tab.svelte', () => {
|
|
5
|
-
it('Renders with minimal props', async () => {
|
|
6
|
-
const { getByTestId } = render(Tab, {
|
|
7
|
-
props: {
|
|
8
|
-
group: 'testGroup',
|
|
9
|
-
name: 'testName',
|
|
10
|
-
value: 'testValue'
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
expect(getByTestId('tab')).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
it('Renders with all props', async () => {
|
|
16
|
-
const { getByTestId } = render(Tab, {
|
|
17
|
-
props: {
|
|
18
|
-
group: 'testGroup',
|
|
19
|
-
name: 'testName',
|
|
20
|
-
value: 'testValue',
|
|
21
|
-
// ---
|
|
22
|
-
borderWidth: 'border-b-2',
|
|
23
|
-
borderColor: 'border-primary-500',
|
|
24
|
-
color: 'text-primary-500',
|
|
25
|
-
fill: 'fill-primary-500'
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
expect(getByTestId('tab')).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/svelte';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { writable } from 'svelte/store';
|
|
4
|
-
import TabGroup from './TabGroup.svelte';
|
|
5
|
-
describe('TabGroup.svelte', () => {
|
|
6
|
-
it('Renders with minimal props', async () => {
|
|
7
|
-
const { getByTestId } = render(TabGroup, { props: { selected: writable(0) } });
|
|
8
|
-
expect(getByTestId('tab-group')).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
it('Renders with minimal props', async () => {
|
|
11
|
-
const { getByTestId } = render(TabGroup, {
|
|
12
|
-
props: {
|
|
13
|
-
selected: writable(0),
|
|
14
|
-
justify: 'justify-start',
|
|
15
|
-
borderWidth: 'border-b-2',
|
|
16
|
-
borderColor: 'border-primary-500',
|
|
17
|
-
color: 'text-primary-500',
|
|
18
|
-
fill: 'fill-primary-500',
|
|
19
|
-
hover: 'hover:bg-primary-500/10',
|
|
20
|
-
labelledby: 'testTabGroupLabel1',
|
|
21
|
-
label: 'testTabGroup1'
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(getByTestId('tab-group')).toBeTruthy();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
});
|