@getmicdrop/svelte-components 2.0.4 → 2.0.6
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/Alert/Alert.spec.js +170 -170
- package/dist/components/Badges/Badge.spec.js +103 -103
- package/dist/components/BottomSheet/BottomSheet.spec.js +127 -127
- package/dist/components/Breadcrumb/Breadcrumb.spec.js +120 -120
- package/dist/components/Button/Button.spec.js +211 -211
- package/dist/components/Button/ButtonSaveDemo.spec.js +48 -48
- package/dist/components/Calendar/Calendar.spec.js +131 -131
- package/dist/components/Calendar/QuarterView.spec.js +394 -394
- package/dist/components/Card.spec.js +47 -47
- package/dist/components/CropImage/CropImage.spec.js +216 -216
- package/dist/components/DarkModeToggle.spec.js +357 -357
- package/dist/components/ErrorDisplay.spec.js +69 -69
- package/dist/components/FormActions.spec.js +88 -88
- package/dist/components/FormValidationSummary.spec.js +203 -203
- package/dist/components/Icons/Icon.spec.js +175 -175
- package/dist/components/Icons/MoreHori.spec.js +67 -67
- package/dist/components/Icons/WarningIcon.spec.js +30 -30
- package/dist/components/Input/Input.spec.js +573 -573
- package/dist/components/Input/MultiSelect.spec.js +257 -257
- package/dist/components/Input/OTPInput.spec.js +238 -238
- package/dist/components/Input/Select.spec.js +218 -218
- package/dist/components/Layout/BottomNav.spec.js +130 -130
- package/dist/components/Layout/Header.spec.js +203 -203
- package/dist/components/Modal/ConfirmationModal.spec.js +191 -191
- package/dist/components/Modal/Modal.spec.js +95 -95
- package/dist/components/Modal/ModalStateManager.spec.js +100 -100
- package/dist/components/PageLoader.spec.js +54 -54
- package/dist/components/PasswordStrengthIndicator/PasswordStrengthIndicator.spec.js +173 -173
- package/dist/components/PlaceAutocomplete/PlaceAutocomplete.spec.js +300 -300
- package/dist/components/Spinner/Spinner.spec.js +75 -75
- package/dist/components/StatusIndicator/StatusIndicator.spec.js +129 -129
- package/dist/components/Toaster/Toaster.stories.svelte +1 -1
- package/dist/components/Toggle.spec.js +158 -158
- package/dist/components/ValidationError.spec.js +79 -79
- package/dist/components/pages/performers/AvailabilityCalendarModal.spec.js +606 -606
- package/dist/components/pages/performers/AvailabilityCalendarModal.svelte +4 -4
- package/dist/components/pages/performers/ModalShowInfo.spec.js +124 -124
- package/dist/components/pages/performers/ModalShowInfo.svelte +1 -1
- package/dist/components/pages/performers/PageBackButton.spec.js +89 -89
- package/dist/components/pages/performers/SectionHeader.spec.js +75 -75
- package/dist/components/pages/performers/ShowDetails.spec.js +166 -166
- package/dist/components/pages/performers/ShowItemCard.spec.js +793 -793
- package/dist/components/pages/performers/ShowItemCard.svelte +4 -4
- package/dist/components/pages/performers/SwitchOption.spec.js +127 -127
- package/dist/components/pages/performers/VenueInfo.spec.js +167 -167
- package/dist/components/pages/performers/VenueInfo.svelte +1 -1
- package/dist/components/pages/performers/VenueItemCard.spec.js +763 -763
- package/dist/components/pages/performers/VenueItemCard.svelte +4 -4
- package/dist/components/pages/profile/profile-form.spec.js +9 -9
- package/dist/components/pages/settings/tabs/CustomImageDropzone.svelte +3 -3
- package/dist/components/pages/shows/ShowList.spec.js +33 -33
- package/dist/components/pages/shows/TabContent.spec.js +90 -90
- package/dist/components/pages/shows/TabNavigation.spec.js +143 -143
- package/dist/config.js +5 -5
- package/dist/config.spec.js +29 -29
- package/dist/constants/formOptions.js +25 -25
- package/dist/constants/formOptions.spec.js +88 -88
- package/dist/index.js +111 -111
- package/dist/stores/auth.d.ts +9 -0
- package/dist/stores/auth.d.ts.map +1 -0
- package/dist/stores/auth.js +36 -0
- package/dist/stores/auth.spec.d.ts +2 -0
- package/dist/stores/auth.spec.d.ts.map +1 -0
- package/dist/stores/auth.spec.js +139 -0
- package/dist/stores/formDataStore.d.ts +17 -0
- package/dist/stores/formDataStore.d.ts.map +1 -0
- package/dist/stores/formDataStore.js +25 -0
- package/dist/stores/formDataStore.spec.d.ts +2 -0
- package/dist/stores/formDataStore.spec.d.ts.map +1 -0
- package/dist/stores/formDataStore.spec.js +257 -0
- package/dist/stores/formSave.d.ts +24 -0
- package/dist/stores/formSave.d.ts.map +1 -0
- package/dist/stores/formSave.js +132 -0
- package/dist/stores/formSave.spec.d.ts +2 -0
- package/dist/stores/formSave.spec.d.ts.map +1 -0
- package/dist/stores/formSave.spec.js +296 -0
- package/dist/stores/index.d.ts +1 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/index.js +0 -0
- package/dist/stores/navigation.d.ts +5 -0
- package/dist/stores/navigation.d.ts.map +1 -0
- package/dist/stores/navigation.js +12 -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 +136 -0
- package/dist/stores/toaster.d.ts +4 -0
- package/dist/stores/toaster.d.ts.map +1 -0
- package/dist/stores/toaster.js +13 -0
- package/dist/stores/toaster.spec.d.ts +2 -0
- package/dist/stores/toaster.spec.d.ts.map +1 -0
- package/dist/stores/toaster.spec.js +59 -0
- package/dist/telemetry.js +357 -357
- package/dist/telemetry.server.js +211 -211
- package/dist/telemetry.server.spec.js +434 -434
- package/dist/telemetry.spec.js +660 -660
- package/dist/utils/apiConfig.js +49 -49
- package/dist/utils/apiConfig.spec.js +118 -118
- package/dist/utils/greetings.js +187 -187
- package/dist/utils/greetings.spec.js +337 -337
- package/dist/utils/imageValidation.js +121 -121
- package/dist/utils/imageValidation.spec.js +220 -220
- package/dist/utils/portal.js +25 -25
- package/dist/utils/portal.spec.js +143 -143
- package/dist/utils/utils/utils.js +323 -323
- package/dist/utils/utils/utils.spec.js +698 -698
- package/dist/utils/utils.spec.js +643 -643
- package/package.json +1 -1
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { render, screen } from "@testing-library/svelte";
|
|
2
|
-
import { expect, describe, test } from "vitest";
|
|
3
|
-
import ErrorDisplay from "./ErrorDisplay.svelte";
|
|
4
|
-
|
|
5
|
-
describe("ErrorDisplay Component Tests", () => {
|
|
6
|
-
test("Shows error message when error and show are true", () => {
|
|
7
|
-
render(ErrorDisplay, { props: { error: "Invalid input", show: true } });
|
|
8
|
-
expect(screen.getByText("Invalid input")).toBeInTheDocument();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test("Does not show when error is empty", () => {
|
|
12
|
-
render(ErrorDisplay, { props: { error: "", show: true } });
|
|
13
|
-
expect(screen.queryByText("Invalid input")).not.toBeInTheDocument();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test("Does not show when show is false", () => {
|
|
17
|
-
render(ErrorDisplay, { props: { error: "Error message", show: false } });
|
|
18
|
-
expect(screen.queryByText("Error message")).not.toBeInTheDocument();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("Has error text color", () => {
|
|
22
|
-
const { container } = render(ErrorDisplay, {
|
|
23
|
-
props: { error: "Error", show: true },
|
|
24
|
-
});
|
|
25
|
-
const wrapper = container.firstChild;
|
|
26
|
-
expect(wrapper).toHaveClass("text-accent-Danger");
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("Has shake class when shake is true", () => {
|
|
30
|
-
const { container } = render(ErrorDisplay, {
|
|
31
|
-
props: { error: "Error", show: true, shake: true },
|
|
32
|
-
});
|
|
33
|
-
const wrapper = container.firstChild;
|
|
34
|
-
expect(wrapper).toHaveClass("error-shake");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test("Does not have shake class when shake is false", () => {
|
|
38
|
-
const { container } = render(ErrorDisplay, {
|
|
39
|
-
props: { error: "Error", show: true, shake: false },
|
|
40
|
-
});
|
|
41
|
-
const wrapper = container.firstChild;
|
|
42
|
-
expect(wrapper).not.toHaveClass("error-shake");
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("Contains icon element", () => {
|
|
46
|
-
const { container } = render(ErrorDisplay, {
|
|
47
|
-
props: { error: "Error", show: true },
|
|
48
|
-
});
|
|
49
|
-
const svg = container.querySelector("svg");
|
|
50
|
-
expect(svg).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("Has flex layout", () => {
|
|
54
|
-
const { container } = render(ErrorDisplay, {
|
|
55
|
-
props: { error: "Error", show: true },
|
|
56
|
-
});
|
|
57
|
-
const wrapper = container.firstChild;
|
|
58
|
-
expect(wrapper).toHaveClass("flex");
|
|
59
|
-
expect(wrapper).toHaveClass("items-center");
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test("Applies custom className", () => {
|
|
63
|
-
const { container } = render(ErrorDisplay, {
|
|
64
|
-
props: { error: "Error", show: true, className: "mt-2" },
|
|
65
|
-
});
|
|
66
|
-
const wrapper = container.firstChild;
|
|
67
|
-
expect(wrapper).toHaveClass("mt-2");
|
|
68
|
-
});
|
|
69
|
-
});
|
|
1
|
+
import { render, screen } from "@testing-library/svelte";
|
|
2
|
+
import { expect, describe, test } from "vitest";
|
|
3
|
+
import ErrorDisplay from "./ErrorDisplay.svelte";
|
|
4
|
+
|
|
5
|
+
describe("ErrorDisplay Component Tests", () => {
|
|
6
|
+
test("Shows error message when error and show are true", () => {
|
|
7
|
+
render(ErrorDisplay, { props: { error: "Invalid input", show: true } });
|
|
8
|
+
expect(screen.getByText("Invalid input")).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test("Does not show when error is empty", () => {
|
|
12
|
+
render(ErrorDisplay, { props: { error: "", show: true } });
|
|
13
|
+
expect(screen.queryByText("Invalid input")).not.toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("Does not show when show is false", () => {
|
|
17
|
+
render(ErrorDisplay, { props: { error: "Error message", show: false } });
|
|
18
|
+
expect(screen.queryByText("Error message")).not.toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("Has error text color", () => {
|
|
22
|
+
const { container } = render(ErrorDisplay, {
|
|
23
|
+
props: { error: "Error", show: true },
|
|
24
|
+
});
|
|
25
|
+
const wrapper = container.firstChild;
|
|
26
|
+
expect(wrapper).toHaveClass("text-accent-Danger");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("Has shake class when shake is true", () => {
|
|
30
|
+
const { container } = render(ErrorDisplay, {
|
|
31
|
+
props: { error: "Error", show: true, shake: true },
|
|
32
|
+
});
|
|
33
|
+
const wrapper = container.firstChild;
|
|
34
|
+
expect(wrapper).toHaveClass("error-shake");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("Does not have shake class when shake is false", () => {
|
|
38
|
+
const { container } = render(ErrorDisplay, {
|
|
39
|
+
props: { error: "Error", show: true, shake: false },
|
|
40
|
+
});
|
|
41
|
+
const wrapper = container.firstChild;
|
|
42
|
+
expect(wrapper).not.toHaveClass("error-shake");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("Contains icon element", () => {
|
|
46
|
+
const { container } = render(ErrorDisplay, {
|
|
47
|
+
props: { error: "Error", show: true },
|
|
48
|
+
});
|
|
49
|
+
const svg = container.querySelector("svg");
|
|
50
|
+
expect(svg).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("Has flex layout", () => {
|
|
54
|
+
const { container } = render(ErrorDisplay, {
|
|
55
|
+
props: { error: "Error", show: true },
|
|
56
|
+
});
|
|
57
|
+
const wrapper = container.firstChild;
|
|
58
|
+
expect(wrapper).toHaveClass("flex");
|
|
59
|
+
expect(wrapper).toHaveClass("items-center");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("Applies custom className", () => {
|
|
63
|
+
const { container } = render(ErrorDisplay, {
|
|
64
|
+
props: { error: "Error", show: true, className: "mt-2" },
|
|
65
|
+
});
|
|
66
|
+
const wrapper = container.firstChild;
|
|
67
|
+
expect(wrapper).toHaveClass("mt-2");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { render, screen, fireEvent } from "@testing-library/svelte";
|
|
2
|
-
import userEvent from "@testing-library/user-event";
|
|
3
|
-
import { expect, describe, test, vi } from "vitest";
|
|
4
|
-
import FormActions from "./FormActions.svelte";
|
|
5
|
-
|
|
6
|
-
function setupTest(args = {}) {
|
|
7
|
-
const user = userEvent.setup();
|
|
8
|
-
const { component, container } = render(FormActions, {
|
|
9
|
-
props: {
|
|
10
|
-
onCancel: vi.fn(),
|
|
11
|
-
onSubmit: vi.fn(),
|
|
12
|
-
...args,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
return { user, component, container };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe("FormActions Component Tests", () => {
|
|
19
|
-
test("Renders submit and cancel buttons", () => {
|
|
20
|
-
setupTest();
|
|
21
|
-
expect(screen.getByText("Save")).toBeInTheDocument();
|
|
22
|
-
expect(screen.getByText("Cancel")).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test("Uses custom button labels", () => {
|
|
26
|
-
setupTest({ submitLabel: "Update", cancelLabel: "Discard" });
|
|
27
|
-
expect(screen.getByText("Update")).toBeInTheDocument();
|
|
28
|
-
expect(screen.getByText("Discard")).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test("Calls onSubmit when submit button clicked", async () => {
|
|
32
|
-
const onSubmit = vi.fn();
|
|
33
|
-
const { user } = setupTest({ onSubmit });
|
|
34
|
-
|
|
35
|
-
await user.click(screen.getByText("Save"));
|
|
36
|
-
expect(onSubmit).toHaveBeenCalledTimes(1);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("Calls onCancel when cancel button clicked", async () => {
|
|
40
|
-
const onCancel = vi.fn();
|
|
41
|
-
const { user } = setupTest({ onCancel });
|
|
42
|
-
|
|
43
|
-
await user.click(screen.getByText("Cancel"));
|
|
44
|
-
expect(onCancel).toHaveBeenCalledTimes(1);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("Submit button shows loading state", () => {
|
|
48
|
-
setupTest({ isSubmitting: true });
|
|
49
|
-
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
50
|
-
expect(submitBtn).toBeDisabled();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("Submit button shows success state", () => {
|
|
54
|
-
setupTest({ isSuccess: true });
|
|
55
|
-
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
56
|
-
expect(submitBtn).toHaveClass("btn-success");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test("Submit button is disabled when disabled prop is true", () => {
|
|
60
|
-
setupTest({ disabled: true });
|
|
61
|
-
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
62
|
-
expect(submitBtn).toBeDisabled();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("Hides cancel button when showCancel is false", () => {
|
|
66
|
-
setupTest({ showCancel: false });
|
|
67
|
-
expect(screen.queryByText("Cancel")).not.toBeInTheDocument();
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test("Uses custom submit variant", () => {
|
|
71
|
-
setupTest({ submitVariant: "red-solid" });
|
|
72
|
-
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
73
|
-
expect(submitBtn).toHaveClass("btn-red-solid");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test("Uses custom cancel variant", () => {
|
|
77
|
-
setupTest({ cancelVariant: "blue-outline" });
|
|
78
|
-
const cancelBtn = screen.getByText("Cancel").closest("button, a");
|
|
79
|
-
expect(cancelBtn).toHaveClass("btn-blue-outline");
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("Has responsive layout classes", () => {
|
|
83
|
-
const { container } = setupTest();
|
|
84
|
-
const wrapper = container.firstChild;
|
|
85
|
-
expect(wrapper).toHaveClass("w-full");
|
|
86
|
-
expect(wrapper).toHaveClass("flex");
|
|
87
|
-
});
|
|
88
|
-
});
|
|
1
|
+
import { render, screen, fireEvent } from "@testing-library/svelte";
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { expect, describe, test, vi } from "vitest";
|
|
4
|
+
import FormActions from "./FormActions.svelte";
|
|
5
|
+
|
|
6
|
+
function setupTest(args = {}) {
|
|
7
|
+
const user = userEvent.setup();
|
|
8
|
+
const { component, container } = render(FormActions, {
|
|
9
|
+
props: {
|
|
10
|
+
onCancel: vi.fn(),
|
|
11
|
+
onSubmit: vi.fn(),
|
|
12
|
+
...args,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return { user, component, container };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe("FormActions Component Tests", () => {
|
|
19
|
+
test("Renders submit and cancel buttons", () => {
|
|
20
|
+
setupTest();
|
|
21
|
+
expect(screen.getByText("Save")).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText("Cancel")).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("Uses custom button labels", () => {
|
|
26
|
+
setupTest({ submitLabel: "Update", cancelLabel: "Discard" });
|
|
27
|
+
expect(screen.getByText("Update")).toBeInTheDocument();
|
|
28
|
+
expect(screen.getByText("Discard")).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("Calls onSubmit when submit button clicked", async () => {
|
|
32
|
+
const onSubmit = vi.fn();
|
|
33
|
+
const { user } = setupTest({ onSubmit });
|
|
34
|
+
|
|
35
|
+
await user.click(screen.getByText("Save"));
|
|
36
|
+
expect(onSubmit).toHaveBeenCalledTimes(1);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("Calls onCancel when cancel button clicked", async () => {
|
|
40
|
+
const onCancel = vi.fn();
|
|
41
|
+
const { user } = setupTest({ onCancel });
|
|
42
|
+
|
|
43
|
+
await user.click(screen.getByText("Cancel"));
|
|
44
|
+
expect(onCancel).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("Submit button shows loading state", () => {
|
|
48
|
+
setupTest({ isSubmitting: true });
|
|
49
|
+
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
50
|
+
expect(submitBtn).toBeDisabled();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("Submit button shows success state", () => {
|
|
54
|
+
setupTest({ isSuccess: true });
|
|
55
|
+
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
56
|
+
expect(submitBtn).toHaveClass("btn-success");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("Submit button is disabled when disabled prop is true", () => {
|
|
60
|
+
setupTest({ disabled: true });
|
|
61
|
+
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
62
|
+
expect(submitBtn).toBeDisabled();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("Hides cancel button when showCancel is false", () => {
|
|
66
|
+
setupTest({ showCancel: false });
|
|
67
|
+
expect(screen.queryByText("Cancel")).not.toBeInTheDocument();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("Uses custom submit variant", () => {
|
|
71
|
+
setupTest({ submitVariant: "red-solid" });
|
|
72
|
+
const submitBtn = screen.getByText("Save").closest("button, a");
|
|
73
|
+
expect(submitBtn).toHaveClass("btn-red-solid");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("Uses custom cancel variant", () => {
|
|
77
|
+
setupTest({ cancelVariant: "blue-outline" });
|
|
78
|
+
const cancelBtn = screen.getByText("Cancel").closest("button, a");
|
|
79
|
+
expect(cancelBtn).toHaveClass("btn-blue-outline");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("Has responsive layout classes", () => {
|
|
83
|
+
const { container } = setupTest();
|
|
84
|
+
const wrapper = container.firstChild;
|
|
85
|
+
expect(wrapper).toHaveClass("w-full");
|
|
86
|
+
expect(wrapper).toHaveClass("flex");
|
|
87
|
+
});
|
|
88
|
+
});
|