@canonical/svelte-ds-app-launchpad 0.23.0 → 0.25.0
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/Badge/Badge.svelte +1 -1
- package/dist/components/Badge/Badge.svelte.d.ts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte.d.ts +1 -1
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Button/Button.svelte +20 -20
- package/dist/components/Button/Button.svelte.d.ts +1 -1
- package/dist/components/Button/common/Content/Content.svelte +14 -14
- package/dist/components/Button/common/Content/Content.svelte.d.ts +1 -1
- package/dist/components/Button/common/Content/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/styles.css +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Chip/Chip.svelte +1 -1
- package/dist/components/Chip/Chip.svelte.d.ts +1 -1
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/Link/Link.svelte +1 -1
- package/dist/components/Link/Link.svelte.d.ts +1 -1
- package/dist/components/Link/index.d.ts +1 -1
- package/dist/components/Modal/Modal.svelte +134 -0
- package/dist/components/Modal/Modal.svelte.d.ts +58 -0
- package/dist/components/Modal/index.d.ts +72 -0
- package/dist/components/Modal/index.js +7 -0
- package/dist/components/Modal/styles.css +39 -0
- package/dist/components/Modal/types.d.ts +41 -0
- package/dist/components/Modal/types.js +2 -0
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Spinner/Spinner.svelte +5 -5
- package/dist/components/Spinner/Spinner.svelte.d.ts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.svelte +1 -1
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.svelte.d.ts +1 -1
- package/dist/components/common/ButtonPrimitive/index.d.ts +1 -1
- package/dist/components/common/DialogContent/DialogContent.svelte +35 -0
- package/dist/components/common/DialogContent/DialogContent.svelte.d.ts +24 -0
- package/dist/components/common/DialogContent/common/Body/Body.svelte +14 -0
- package/dist/components/common/DialogContent/common/Body/Body.svelte.d.ts +4 -0
- package/dist/components/common/DialogContent/common/Body/index.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Body/index.js +2 -0
- package/dist/components/common/DialogContent/common/Body/styles.css +5 -0
- package/dist/components/common/DialogContent/common/Body/types.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Body/types.js +2 -0
- package/dist/components/common/DialogContent/common/Footer/Footer.svelte +14 -0
- package/dist/components/common/DialogContent/common/Footer/Footer.svelte.d.ts +4 -0
- package/dist/components/common/DialogContent/common/Footer/index.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Footer/index.js +2 -0
- package/dist/components/common/DialogContent/common/Footer/styles.css +8 -0
- package/dist/components/common/DialogContent/common/Footer/types.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Footer/types.js +2 -0
- package/dist/components/common/DialogContent/common/Header/Header.svelte +14 -0
- package/dist/components/common/DialogContent/common/Header/Header.svelte.d.ts +4 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/CloseButton.svelte +28 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/CloseButton.svelte.d.ts +4 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/index.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/index.js +2 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/types.d.ts +4 -0
- package/dist/components/common/DialogContent/common/Header/common/CloseButton/types.js +2 -0
- package/dist/components/common/DialogContent/common/Header/common/index.d.ts +1 -0
- package/dist/components/common/DialogContent/common/Header/common/index.js +1 -0
- package/dist/components/common/DialogContent/common/Header/index.d.ts +16 -0
- package/dist/components/common/DialogContent/common/Header/index.js +6 -0
- package/dist/components/common/DialogContent/common/Header/styles.css +12 -0
- package/dist/components/common/DialogContent/common/Header/types.d.ts +2 -0
- package/dist/components/common/DialogContent/common/Header/types.js +2 -0
- package/dist/components/common/DialogContent/common/index.d.ts +3 -0
- package/dist/components/common/DialogContent/common/index.js +3 -0
- package/dist/components/common/DialogContent/index.d.ts +42 -0
- package/dist/components/common/DialogContent/index.js +8 -0
- package/dist/components/common/DialogContent/styles.css +11 -0
- package/dist/components/common/DialogContent/types.d.ts +2 -0
- package/dist/components/common/DialogContent/types.js +2 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/index.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/isEventTargetInElement.d.ts +8 -0
- package/dist/utils/isEventTargetInElement.js +13 -0
- package/package.json +13 -10
- package/dist/components/Badge/Badge.ssr.test.d.ts +0 -1
- package/dist/components/Badge/Badge.ssr.test.js +0 -113
- package/dist/components/Badge/Badge.stories.svelte +0 -60
- package/dist/components/Badge/Badge.stories.svelte.d.ts +0 -19
- package/dist/components/Badge/Badge.svelte.test.d.ts +0 -1
- package/dist/components/Badge/Badge.svelte.test.js +0 -120
- package/dist/components/Breadcrumbs/Breadcrumbs.ssr.test.d.ts +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.ssr.test.js +0 -101
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.svelte +0 -139
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.svelte.d.ts +0 -19
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte.test.d.ts +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.svelte.test.js +0 -298
- package/dist/components/Button/Button.ssr.test.d.ts +0 -1
- package/dist/components/Button/Button.ssr.test.js +0 -88
- package/dist/components/Button/Button.stories.svelte +0 -143
- package/dist/components/Button/Button.stories.svelte.d.ts +0 -19
- package/dist/components/Button/Button.svelte.test.d.ts +0 -1
- package/dist/components/Button/Button.svelte.test.js +0 -136
- package/dist/components/Checkbox/Checkbox.ssr.test.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.ssr.test.js +0 -74
- package/dist/components/Checkbox/Checkbox.stories.svelte +0 -105
- package/dist/components/Checkbox/Checkbox.stories.svelte.d.ts +0 -19
- package/dist/components/Checkbox/Checkbox.svelte.test.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.svelte.test.js +0 -115
- package/dist/components/Chip/Chip.ssr.test.d.ts +0 -1
- package/dist/components/Chip/Chip.ssr.test.js +0 -65
- package/dist/components/Chip/Chip.stories.svelte +0 -124
- package/dist/components/Chip/Chip.stories.svelte.d.ts +0 -19
- package/dist/components/Chip/Chip.svelte.test.d.ts +0 -1
- package/dist/components/Chip/Chip.svelte.test.js +0 -132
- package/dist/components/DateTime/DateTime.ssr.test.d.ts +0 -1
- package/dist/components/DateTime/DateTime.ssr.test.js +0 -94
- package/dist/components/DateTime/DateTime.stories.svelte +0 -34
- package/dist/components/DateTime/DateTime.stories.svelte.d.ts +0 -19
- package/dist/components/DateTime/DateTime.svelte.test.d.ts +0 -1
- package/dist/components/DateTime/DateTime.svelte.test.js +0 -81
- package/dist/components/DescriptionList/DescriptionList.ssr.test.d.ts +0 -1
- package/dist/components/DescriptionList/DescriptionList.ssr.test.js +0 -50
- package/dist/components/DescriptionList/DescriptionList.stories.svelte +0 -40
- package/dist/components/DescriptionList/DescriptionList.stories.svelte.d.ts +0 -19
- package/dist/components/DescriptionList/DescriptionList.svelte.test.d.ts +0 -1
- package/dist/components/DescriptionList/DescriptionList.svelte.test.js +0 -45
- package/dist/components/DescriptionList/common/Item/Item.ssr.test.d.ts +0 -1
- package/dist/components/DescriptionList/common/Item/Item.ssr.test.js +0 -66
- package/dist/components/DescriptionList/common/Item/Item.stories.svelte +0 -34
- package/dist/components/DescriptionList/common/Item/Item.stories.svelte.d.ts +0 -19
- package/dist/components/DescriptionList/common/Item/Item.svelte.test.d.ts +0 -1
- package/dist/components/DescriptionList/common/Item/Item.svelte.test.js +0 -62
- package/dist/components/Link/Link.ssr.test.d.ts +0 -1
- package/dist/components/Link/Link.ssr.test.js +0 -59
- package/dist/components/Link/Link.stories.svelte +0 -18
- package/dist/components/Link/Link.stories.svelte.d.ts +0 -19
- package/dist/components/Link/Link.svelte.test.d.ts +0 -1
- package/dist/components/Link/Link.svelte.test.js +0 -56
- package/dist/components/NumberInput/NumberInput.ssr.test.d.ts +0 -1
- package/dist/components/NumberInput/NumberInput.ssr.test.js +0 -84
- package/dist/components/NumberInput/NumberInput.stories.svelte +0 -67
- package/dist/components/NumberInput/NumberInput.stories.svelte.d.ts +0 -4
- package/dist/components/NumberInput/NumberInput.svelte.test.d.ts +0 -1
- package/dist/components/NumberInput/NumberInput.svelte.test.js +0 -96
- package/dist/components/Popover/Popover.ssr.test.d.ts +0 -1
- package/dist/components/Popover/Popover.ssr.test.js +0 -70
- package/dist/components/Popover/Popover.stories.svelte +0 -170
- package/dist/components/Popover/Popover.stories.svelte.d.ts +0 -4
- package/dist/components/Popover/Popover.svelte.test.d.ts +0 -1
- package/dist/components/Popover/Popover.svelte.test.js +0 -137
- package/dist/components/Popover/test.fixtures.svelte +0 -24
- package/dist/components/Popover/test.fixtures.svelte.d.ts +0 -25
- package/dist/components/Radio/Radio.ssr.test.d.ts +0 -1
- package/dist/components/Radio/Radio.ssr.test.js +0 -75
- package/dist/components/Radio/Radio.stories.svelte +0 -93
- package/dist/components/Radio/Radio.stories.svelte.d.ts +0 -19
- package/dist/components/Radio/Radio.svelte.test.d.ts +0 -1
- package/dist/components/Radio/Radio.svelte.test.js +0 -100
- package/dist/components/RelativeDateTime/RelativeDateTime.ssr.test.d.ts +0 -1
- package/dist/components/RelativeDateTime/RelativeDateTime.ssr.test.js +0 -130
- package/dist/components/RelativeDateTime/RelativeDateTime.stories.svelte +0 -41
- package/dist/components/RelativeDateTime/RelativeDateTime.stories.svelte.d.ts +0 -19
- package/dist/components/RelativeDateTime/RelativeDateTime.svelte.test.d.ts +0 -1
- package/dist/components/RelativeDateTime/RelativeDateTime.svelte.test.js +0 -152
- package/dist/components/RelativeDateTime/utils/getOptimalRelativeTimeFormatValue.test.d.ts +0 -1
- package/dist/components/RelativeDateTime/utils/getOptimalRelativeTimeFormatValue.test.js +0 -65
- package/dist/components/Spinner/Spinner.ssr.test.d.ts +0 -1
- package/dist/components/Spinner/Spinner.ssr.test.js +0 -29
- package/dist/components/Spinner/Spinner.stories.svelte +0 -16
- package/dist/components/Spinner/Spinner.stories.svelte.d.ts +0 -19
- package/dist/components/Spinner/Spinner.svelte.test.d.ts +0 -1
- package/dist/components/Spinner/Spinner.svelte.test.js +0 -25
- package/dist/components/Switch/Switch.ssr.test.d.ts +0 -1
- package/dist/components/Switch/Switch.ssr.test.js +0 -98
- package/dist/components/Switch/Switch.stories.svelte +0 -93
- package/dist/components/Switch/Switch.stories.svelte.d.ts +0 -19
- package/dist/components/Switch/Switch.svelte.test.d.ts +0 -1
- package/dist/components/Switch/Switch.svelte.test.js +0 -143
- package/dist/components/TextInput/TextInput.ssr.test.d.ts +0 -1
- package/dist/components/TextInput/TextInput.ssr.test.js +0 -90
- package/dist/components/TextInput/TextInput.stories.svelte +0 -96
- package/dist/components/TextInput/TextInput.stories.svelte.d.ts +0 -4
- package/dist/components/TextInput/TextInput.svelte.test.d.ts +0 -1
- package/dist/components/TextInput/TextInput.svelte.test.js +0 -118
- package/dist/components/Textarea/Textarea.ssr.test.d.ts +0 -1
- package/dist/components/Textarea/Textarea.ssr.test.js +0 -49
- package/dist/components/Textarea/Textarea.stories.svelte +0 -58
- package/dist/components/Textarea/Textarea.stories.svelte.d.ts +0 -19
- package/dist/components/Textarea/Textarea.svelte.test.d.ts +0 -1
- package/dist/components/Textarea/Textarea.svelte.test.js +0 -90
- package/dist/components/Textarea/utils/calculateDynamicRows.svelte.test.d.ts +0 -1
- package/dist/components/Textarea/utils/calculateDynamicRows.svelte.test.js +0 -148
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.ssr.test.d.ts +0 -1
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.ssr.test.js +0 -71
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.svelte.test.d.ts +0 -1
- package/dist/components/common/ButtonPrimitive/ButtonPrimitive.svelte.test.js +0 -75
- package/dist/components/common/InputPrimitive/InputPrimitive.ssr.test.d.ts +0 -1
- package/dist/components/common/InputPrimitive/InputPrimitive.ssr.test.js +0 -100
- package/dist/components/common/InputPrimitive/InputPrimitive.svelte.test.d.ts +0 -1
- package/dist/components/common/InputPrimitive/InputPrimitive.svelte.test.js +0 -91
- package/dist/test-utils.d.ts +0 -6
- package/dist/test-utils.js +0 -18
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { render } from "@canonical/svelte-ssr-test";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import Component from "./Checkbox.svelte";
|
|
4
|
-
describe("Checkbox SSR", () => {
|
|
5
|
-
describe("basics", () => {
|
|
6
|
-
it("doesn't throw", () => {
|
|
7
|
-
expect(() => {
|
|
8
|
-
render(Component, {});
|
|
9
|
-
}).not.toThrow();
|
|
10
|
-
});
|
|
11
|
-
it("renders", () => {
|
|
12
|
-
const page = render(Component, {});
|
|
13
|
-
expect(componentLocator(page)).toBeInstanceOf(page.window.HTMLInputElement);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
describe("attributes", () => {
|
|
17
|
-
it.each([
|
|
18
|
-
["id", "test-id"],
|
|
19
|
-
["aria-label", "test-aria-label"],
|
|
20
|
-
])("applies %s", (attribute, expected) => {
|
|
21
|
-
const page = render(Component, { props: { [attribute]: expected } });
|
|
22
|
-
expect(componentLocator(page).getAttribute(attribute)).toBe(expected);
|
|
23
|
-
});
|
|
24
|
-
it("applies classes", () => {
|
|
25
|
-
const page = render(Component, { props: { class: "test-class" } });
|
|
26
|
-
expect(componentLocator(page).classList).toContain("test-class");
|
|
27
|
-
expect(componentLocator(page).classList).toContain("ds");
|
|
28
|
-
expect(componentLocator(page).classList).toContain("checkbox");
|
|
29
|
-
});
|
|
30
|
-
it("applies style", () => {
|
|
31
|
-
const page = render(Component, { props: { style: "color: orange;" } });
|
|
32
|
-
expect(componentLocator(page).style.color).toBe("orange");
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe("Checked state", () => {
|
|
36
|
-
it("isn't checked by default", () => {
|
|
37
|
-
const page = render(Component);
|
|
38
|
-
expect(componentLocator(page).checked).toBe(false);
|
|
39
|
-
});
|
|
40
|
-
it("can be checked", () => {
|
|
41
|
-
const page = render(Component, { props: { checked: true } });
|
|
42
|
-
expect(componentLocator(page).checked).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
describe("Group controlled", () => {
|
|
46
|
-
it("isn't checked if group and value are undefined", () => {
|
|
47
|
-
const page = render(Component, {
|
|
48
|
-
props: { group: undefined, value: undefined },
|
|
49
|
-
});
|
|
50
|
-
expect(componentLocator(page).checked).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
it("isn't checked if group doesn't include value", () => {
|
|
53
|
-
const page = render(Component, {
|
|
54
|
-
props: {
|
|
55
|
-
group: ["a", "b"],
|
|
56
|
-
value: "c",
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
expect(componentLocator(page).checked).toBe(false);
|
|
60
|
-
});
|
|
61
|
-
it("is checked if group includes value", () => {
|
|
62
|
-
const page = render(Component, {
|
|
63
|
-
props: {
|
|
64
|
-
group: ["a", "b", "c"],
|
|
65
|
-
value: "c",
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
expect(componentLocator(page).checked).toBe(true);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
function componentLocator(page) {
|
|
73
|
-
return page.getByRole("checkbox");
|
|
74
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
-
import Checkbox from "./Checkbox.svelte";
|
|
4
|
-
import type { CheckboxProps } from "./types.js";
|
|
5
|
-
|
|
6
|
-
const { Story } = defineMeta({
|
|
7
|
-
title: "Components/Checkbox",
|
|
8
|
-
tags: ["autodocs"],
|
|
9
|
-
render,
|
|
10
|
-
argTypes: {
|
|
11
|
-
checked: {
|
|
12
|
-
control: { type: "boolean" },
|
|
13
|
-
description: "Whether the checkbox is checked\n\n**@bindable**",
|
|
14
|
-
type: "boolean",
|
|
15
|
-
defaultValue: false,
|
|
16
|
-
},
|
|
17
|
-
disabled: {
|
|
18
|
-
control: { type: "boolean" },
|
|
19
|
-
description: "Disables the checkbox, preventing user interaction",
|
|
20
|
-
type: "boolean",
|
|
21
|
-
defaultValue: false,
|
|
22
|
-
},
|
|
23
|
-
indeterminate: {
|
|
24
|
-
control: { type: "boolean" },
|
|
25
|
-
description:
|
|
26
|
-
"Visually displays the checkbox in an indeterminate state (does not affect the actual checked value)",
|
|
27
|
-
type: "boolean",
|
|
28
|
-
defaultValue: false,
|
|
29
|
-
},
|
|
30
|
-
group: {
|
|
31
|
-
control: { disable: true },
|
|
32
|
-
description: `Used to control checkboxes as a group, similarly to [native Svelte bind:group](https://svelte.dev/docs/svelte/bind#input-bind:group)
|
|
33
|
-
|
|
34
|
-
**@bindable**
|
|
35
|
-
|
|
36
|
-
- Cannot coexist with \`checked\`.
|
|
37
|
-
- Requires \`value: T\` to be set for each checkbox in the group.
|
|
38
|
-
`,
|
|
39
|
-
table: {
|
|
40
|
-
type: { summary: `T[] where T extends HTMLInputAttributes["value"]` },
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
let group = $state<string[]>([]);
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
{#snippet render(args: CheckboxProps)}
|
|
50
|
-
<label>
|
|
51
|
-
<Checkbox {...args} />
|
|
52
|
-
I'm a checkbox
|
|
53
|
-
</label>
|
|
54
|
-
{/snippet}
|
|
55
|
-
|
|
56
|
-
<!-- As an input control, it requires a `<label>` associated with it. -->
|
|
57
|
-
<Story name="Default" />
|
|
58
|
-
<Story name="Checked" args={{ checked: true }} />
|
|
59
|
-
<Story name="Disabled" args={{ disabled: true }} />
|
|
60
|
-
<Story name="Disabled checked" args={{ checked: true, disabled: true }} />
|
|
61
|
-
<Story name="Indeterminate" args={{ indeterminate: true }} />
|
|
62
|
-
<Story
|
|
63
|
-
name="Indeterminate disabled"
|
|
64
|
-
args={{ disabled: true, indeterminate: true }}
|
|
65
|
-
/>
|
|
66
|
-
|
|
67
|
-
<Story
|
|
68
|
-
name="Group controlled"
|
|
69
|
-
argTypes={{ checked: { table: { disable: true } } }}
|
|
70
|
-
>
|
|
71
|
-
{#snippet template({ checked: _, ...args })}
|
|
72
|
-
<!--
|
|
73
|
-
<script lang="ts">
|
|
74
|
-
let group = $state<string[]>([]);
|
|
75
|
-
</script>
|
|
76
|
-
-->
|
|
77
|
-
|
|
78
|
-
Selected values: {group.join(", ")}
|
|
79
|
-
|
|
80
|
-
<label>
|
|
81
|
-
<Checkbox {...args} bind:group value="Option 1" />
|
|
82
|
-
Option 1
|
|
83
|
-
</label>
|
|
84
|
-
<label>
|
|
85
|
-
<Checkbox {...args} bind:group value="Option 2" />
|
|
86
|
-
Option 2
|
|
87
|
-
</label>
|
|
88
|
-
<label>
|
|
89
|
-
<Checkbox {...args} bind:group value="Option 3" />
|
|
90
|
-
Option 3
|
|
91
|
-
</label>
|
|
92
|
-
<label>
|
|
93
|
-
<Checkbox {...args} bind:group value="Option 4" />
|
|
94
|
-
Option 4
|
|
95
|
-
</label>
|
|
96
|
-
{/snippet}
|
|
97
|
-
</Story>
|
|
98
|
-
|
|
99
|
-
<style>
|
|
100
|
-
label {
|
|
101
|
-
display: flex;
|
|
102
|
-
align-items: center;
|
|
103
|
-
gap: 0.5rem;
|
|
104
|
-
}
|
|
105
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Checkbox from "./Checkbox.svelte";
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Checkbox: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type Checkbox = InstanceType<typeof Checkbox>;
|
|
19
|
-
export default Checkbox;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { render } from "vitest-browser-svelte";
|
|
3
|
-
import Component from "./Checkbox.svelte";
|
|
4
|
-
describe("Checkbox component", () => {
|
|
5
|
-
const baseProps = {};
|
|
6
|
-
it("renders", async () => {
|
|
7
|
-
const page = render(Component, { ...baseProps });
|
|
8
|
-
await expect.element(componentLocator(page)).toBeInTheDocument();
|
|
9
|
-
});
|
|
10
|
-
describe("attributes", () => {
|
|
11
|
-
it.each([
|
|
12
|
-
["id", "test-id"],
|
|
13
|
-
["aria-label", "test-aria-label"],
|
|
14
|
-
])("applies %s", async (attribute, expected) => {
|
|
15
|
-
const page = render(Component, { ...baseProps, [attribute]: expected });
|
|
16
|
-
await expect
|
|
17
|
-
.element(componentLocator(page))
|
|
18
|
-
.toHaveAttribute(attribute, expected);
|
|
19
|
-
});
|
|
20
|
-
it("applies classes", async () => {
|
|
21
|
-
const page = render(Component, { ...baseProps, class: "test-class" });
|
|
22
|
-
await expect.element(componentLocator(page)).toHaveClass("test-class");
|
|
23
|
-
await expect.element(componentLocator(page)).toHaveClass("ds");
|
|
24
|
-
await expect.element(componentLocator(page)).toHaveClass("checkbox");
|
|
25
|
-
});
|
|
26
|
-
it("applies style", async () => {
|
|
27
|
-
const page = render(Component, {
|
|
28
|
-
...baseProps,
|
|
29
|
-
style: "color: orange;",
|
|
30
|
-
});
|
|
31
|
-
await expect
|
|
32
|
-
.element(componentLocator(page))
|
|
33
|
-
.toHaveStyle({ color: "orange" });
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
describe("Checked state", () => {
|
|
37
|
-
it("is not checked by default", async () => {
|
|
38
|
-
const page = render(Component, { ...baseProps });
|
|
39
|
-
await expect.element(componentLocator(page)).not.toBeChecked();
|
|
40
|
-
});
|
|
41
|
-
it("can be checked", async () => {
|
|
42
|
-
const page = render(Component, { ...baseProps, checked: true });
|
|
43
|
-
await expect.element(componentLocator(page)).toBeChecked();
|
|
44
|
-
});
|
|
45
|
-
it("isn't disabled by default", async () => {
|
|
46
|
-
const page = render(Component, { ...baseProps });
|
|
47
|
-
await expect.element(componentLocator(page)).not.toBeDisabled();
|
|
48
|
-
});
|
|
49
|
-
it("can be disabled", async () => {
|
|
50
|
-
const page = render(Component, { ...baseProps, disabled: true });
|
|
51
|
-
await expect.element(componentLocator(page)).toBeDisabled();
|
|
52
|
-
});
|
|
53
|
-
it("toggles on click", async () => {
|
|
54
|
-
const page = render(Component, { ...baseProps });
|
|
55
|
-
const checkbox = componentLocator(page);
|
|
56
|
-
await expect.element(checkbox).not.toBeChecked();
|
|
57
|
-
await checkbox.click();
|
|
58
|
-
await expect.element(checkbox).toBeChecked();
|
|
59
|
-
});
|
|
60
|
-
it("is not indeterminate by default", async () => {
|
|
61
|
-
const page = render(Component, { ...baseProps });
|
|
62
|
-
await expect
|
|
63
|
-
.element(componentLocator(page))
|
|
64
|
-
.not.toHaveAttribute("indeterminate");
|
|
65
|
-
});
|
|
66
|
-
it("can be indeterminate", async () => {
|
|
67
|
-
const onlyIndeterminate = render(Component, {
|
|
68
|
-
...baseProps,
|
|
69
|
-
indeterminate: true,
|
|
70
|
-
});
|
|
71
|
-
await expect
|
|
72
|
-
.element(componentLocator(onlyIndeterminate))
|
|
73
|
-
.toBePartiallyChecked();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
describe("Group controlled", () => {
|
|
77
|
-
it("isn't checked if group and value are undefined", async () => {
|
|
78
|
-
const page = render(Component, {
|
|
79
|
-
...baseProps,
|
|
80
|
-
group: undefined,
|
|
81
|
-
value: undefined,
|
|
82
|
-
});
|
|
83
|
-
await expect.element(componentLocator(page)).not.toBeChecked();
|
|
84
|
-
});
|
|
85
|
-
it("isn't checked if group doesn't include value", async () => {
|
|
86
|
-
const page = render(Component, {
|
|
87
|
-
...baseProps,
|
|
88
|
-
group: ["a", "b"],
|
|
89
|
-
value: "c",
|
|
90
|
-
});
|
|
91
|
-
await expect.element(componentLocator(page)).not.toBeChecked();
|
|
92
|
-
});
|
|
93
|
-
it("is checked if group includes value", async () => {
|
|
94
|
-
const page = render(Component, {
|
|
95
|
-
...baseProps,
|
|
96
|
-
group: ["a", "b", "c"],
|
|
97
|
-
value: "c",
|
|
98
|
-
});
|
|
99
|
-
await expect.element(componentLocator(page)).toBeChecked();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
describe("Events", () => {
|
|
103
|
-
it("emits change event on click", async () => {
|
|
104
|
-
const onchange = vi.fn();
|
|
105
|
-
const page = render(Component, { ...baseProps, onchange });
|
|
106
|
-
const checkbox = componentLocator(page);
|
|
107
|
-
await expect.element(checkbox).not.toBeChecked();
|
|
108
|
-
await checkbox.click();
|
|
109
|
-
expect(onchange).toHaveBeenCalledOnce();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
function componentLocator(page) {
|
|
114
|
-
return page.getByRole("checkbox");
|
|
115
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Generated by @canonical/summon:component-svelte v0.1.0
|
|
2
|
-
import { render } from "@canonical/svelte-ssr-test";
|
|
3
|
-
import { describe, expect, it } from "vitest";
|
|
4
|
-
import Component from "./Chip.svelte";
|
|
5
|
-
describe("Chip SSR", () => {
|
|
6
|
-
const baseProps = {
|
|
7
|
-
value: "Test",
|
|
8
|
-
"data-testid": "chip",
|
|
9
|
-
};
|
|
10
|
-
describe("basics", () => {
|
|
11
|
-
it("doesn't throw", () => {
|
|
12
|
-
expect(() => render(Component, { props: { ...baseProps } })).not.toThrow();
|
|
13
|
-
});
|
|
14
|
-
it("renders value", () => {
|
|
15
|
-
const page = render(Component, {
|
|
16
|
-
props: { ...baseProps, value: "Essential Content" },
|
|
17
|
-
});
|
|
18
|
-
expect(componentLocator(page).textContent).toContain("Essential Content");
|
|
19
|
-
});
|
|
20
|
-
it("renders as a span by default", () => {
|
|
21
|
-
const page = render(Component, {
|
|
22
|
-
props: { ...baseProps, value: "Span Chip" },
|
|
23
|
-
});
|
|
24
|
-
expect(componentLocator(page)).toBeInstanceOf(page.window.HTMLSpanElement);
|
|
25
|
-
expect(page.queryByRole("button")).toBeNull();
|
|
26
|
-
});
|
|
27
|
-
it("renders lead and value text", () => {
|
|
28
|
-
const page = render(Component, {
|
|
29
|
-
props: { ...baseProps, lead: "Key:", value: "Value" },
|
|
30
|
-
});
|
|
31
|
-
expect(page.getByText("Key:")).toBeTruthy();
|
|
32
|
-
expect(page.getByText("Value")).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
describe("State Variants", () => {
|
|
36
|
-
it("renders as a button when onclick is provided", () => {
|
|
37
|
-
const page = render(Component, {
|
|
38
|
-
props: { ...baseProps, value: "Clickable", onclick: () => { } },
|
|
39
|
-
});
|
|
40
|
-
expect(page.getByRole("button")).toBeInstanceOf(page.window.HTMLButtonElement);
|
|
41
|
-
});
|
|
42
|
-
it("renders a dismiss button when ondismiss is provided", () => {
|
|
43
|
-
const page = render(Component, {
|
|
44
|
-
props: { ...baseProps, value: "Dismissible", ondismiss: () => { } },
|
|
45
|
-
});
|
|
46
|
-
expect(componentLocator(page)).toBeInstanceOf(page.window.HTMLSpanElement);
|
|
47
|
-
expect(page.getByRole("button", { name: "Dismiss" })).toBeInstanceOf(page.window.HTMLButtonElement);
|
|
48
|
-
});
|
|
49
|
-
it("is non-interactive when readonly", () => {
|
|
50
|
-
const page = render(Component, {
|
|
51
|
-
props: {
|
|
52
|
-
...baseProps,
|
|
53
|
-
value: "Readonly Chip",
|
|
54
|
-
readonly: true,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
expect(componentLocator(page)).toBeInstanceOf(page.window.HTMLSpanElement);
|
|
58
|
-
expect(componentLocator(page).classList.contains("readonly")).toBe(true);
|
|
59
|
-
expect(page.queryByRole("button")).toBeNull();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
function componentLocator(page) {
|
|
64
|
-
return page.getByTestId("chip");
|
|
65
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
// Generated by @canonical/summon:component-svelte v0.1.0
|
|
3
|
-
|
|
4
|
-
import { ArchiveIcon } from "@canonical/svelte-icons";
|
|
5
|
-
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
6
|
-
import { fn } from "storybook/test";
|
|
7
|
-
import { MODIFIER_FAMILIES } from "../../modifier-families/index.js";
|
|
8
|
-
import { Badge } from "../Badge/index.js";
|
|
9
|
-
import Chip from "./Chip.svelte";
|
|
10
|
-
|
|
11
|
-
const { Story } = defineMeta({
|
|
12
|
-
title: "Components/Chip",
|
|
13
|
-
component: Chip,
|
|
14
|
-
tags: ["autodocs"],
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<Story
|
|
19
|
-
name="Default interactive chip"
|
|
20
|
-
args={{
|
|
21
|
-
value: "Value",
|
|
22
|
-
onclick: fn(),
|
|
23
|
-
}}
|
|
24
|
-
/>
|
|
25
|
-
|
|
26
|
-
<Story name="Severities">
|
|
27
|
-
{#snippet template(args)}
|
|
28
|
-
{#each MODIFIER_FAMILIES.severity as severity (severity)}
|
|
29
|
-
<Chip
|
|
30
|
-
{...args}
|
|
31
|
-
lead="Severity"
|
|
32
|
-
value={severity}
|
|
33
|
-
{severity}
|
|
34
|
-
onclick={fn()}
|
|
35
|
-
/>
|
|
36
|
-
<br />
|
|
37
|
-
<br />
|
|
38
|
-
{/each}
|
|
39
|
-
{/snippet}
|
|
40
|
-
</Story>
|
|
41
|
-
|
|
42
|
-
<Story
|
|
43
|
-
name="With icon and lead"
|
|
44
|
-
args={{
|
|
45
|
-
lead: "Lead",
|
|
46
|
-
value: "Value",
|
|
47
|
-
severity: "caution",
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
{#snippet template(args)}
|
|
51
|
-
<Chip {...args}>
|
|
52
|
-
{#snippet icon()}
|
|
53
|
-
<ArchiveIcon />
|
|
54
|
-
{/snippet}
|
|
55
|
-
</Chip>
|
|
56
|
-
{/snippet}
|
|
57
|
-
</Story>
|
|
58
|
-
|
|
59
|
-
<Story
|
|
60
|
-
name="Dismissable chip"
|
|
61
|
-
args={{
|
|
62
|
-
lead: "Owner",
|
|
63
|
-
value: "Bob",
|
|
64
|
-
ondismiss: fn(),
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
|
|
68
|
-
<Story
|
|
69
|
-
name="With a badge"
|
|
70
|
-
args={{
|
|
71
|
-
lead: "Lead",
|
|
72
|
-
value: "Value",
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
{#snippet template(args)}
|
|
76
|
-
<Chip {...args}>
|
|
77
|
-
{#snippet badge()}
|
|
78
|
-
<Badge value={42} />
|
|
79
|
-
{/snippet}
|
|
80
|
-
</Chip>
|
|
81
|
-
{/snippet}
|
|
82
|
-
</Story>
|
|
83
|
-
|
|
84
|
-
<Story name="Read-only">
|
|
85
|
-
{#snippet template(args)}
|
|
86
|
-
{#each MODIFIER_FAMILIES.severity as severity (severity)}
|
|
87
|
-
<Chip
|
|
88
|
-
{...args}
|
|
89
|
-
lead="Severity"
|
|
90
|
-
value={severity || "default"}
|
|
91
|
-
readonly
|
|
92
|
-
{severity}
|
|
93
|
-
>
|
|
94
|
-
{#snippet badge()}
|
|
95
|
-
<Badge value={420} />
|
|
96
|
-
{/snippet}
|
|
97
|
-
</Chip>
|
|
98
|
-
<br />
|
|
99
|
-
<br />
|
|
100
|
-
{/each}
|
|
101
|
-
{/snippet}
|
|
102
|
-
</Story>
|
|
103
|
-
|
|
104
|
-
<Story
|
|
105
|
-
name="With all the elements"
|
|
106
|
-
tags={["!autodocs"]}
|
|
107
|
-
args={{
|
|
108
|
-
lead: "Lead",
|
|
109
|
-
value: "Value",
|
|
110
|
-
ondismiss: fn(),
|
|
111
|
-
onclick: fn(),
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
{#snippet template(args)}
|
|
115
|
-
<Chip {...args}>
|
|
116
|
-
{#snippet icon()}
|
|
117
|
-
<ArchiveIcon />
|
|
118
|
-
{/snippet}
|
|
119
|
-
{#snippet badge()}
|
|
120
|
-
<Badge value={420} />
|
|
121
|
-
{/snippet}
|
|
122
|
-
</Chip>
|
|
123
|
-
{/snippet}
|
|
124
|
-
</Story>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Chip from "./Chip.svelte";
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const Chip: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
}, {}, {}, string>;
|
|
18
|
-
type Chip = InstanceType<typeof Chip>;
|
|
19
|
-
export default Chip;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Generated by @canonical/summon:component-svelte v0.1.0
|
|
2
|
-
import { createRawSnippet } from "svelte";
|
|
3
|
-
import { describe, expect, it, vi } from "vitest";
|
|
4
|
-
import { render } from "vitest-browser-svelte";
|
|
5
|
-
import Component from "./Chip.svelte";
|
|
6
|
-
describe("Chip component", () => {
|
|
7
|
-
const baseProps = {
|
|
8
|
-
value: "Chip",
|
|
9
|
-
"data-testid": "chip",
|
|
10
|
-
};
|
|
11
|
-
it("renders", async () => {
|
|
12
|
-
const page = render(Component, { ...baseProps });
|
|
13
|
-
await expect.element(componentLocator(page)).toBeInTheDocument();
|
|
14
|
-
});
|
|
15
|
-
describe("attributes", () => {
|
|
16
|
-
it.each([
|
|
17
|
-
["id", "test-id"],
|
|
18
|
-
["aria-label", "test-aria-label"],
|
|
19
|
-
])("applies %s", async (attribute, expected) => {
|
|
20
|
-
const page = render(Component, { ...baseProps, [attribute]: expected });
|
|
21
|
-
await expect
|
|
22
|
-
.element(componentLocator(page))
|
|
23
|
-
.toHaveAttribute(attribute, expected);
|
|
24
|
-
});
|
|
25
|
-
it("applies classes", async () => {
|
|
26
|
-
const page = render(Component, { ...baseProps, class: "test-class" });
|
|
27
|
-
await expect.element(componentLocator(page)).toHaveClass("test-class");
|
|
28
|
-
await expect.element(componentLocator(page)).toHaveClass("ds");
|
|
29
|
-
await expect.element(componentLocator(page)).toHaveClass("chip");
|
|
30
|
-
});
|
|
31
|
-
it("applies style", async () => {
|
|
32
|
-
const page = render(Component, {
|
|
33
|
-
...baseProps,
|
|
34
|
-
style: "color: orange;",
|
|
35
|
-
});
|
|
36
|
-
await expect
|
|
37
|
-
.element(componentLocator(page))
|
|
38
|
-
.toHaveStyle({ color: "orange" });
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe("Initial Rendering", () => {
|
|
42
|
-
it("should render with default props as a non-interactive element", async () => {
|
|
43
|
-
const page = render(Component, { ...baseProps, value: "Default Chip" });
|
|
44
|
-
await expect.element(page.getByRole("button")).not.toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
it("should render with a lead element", async () => {
|
|
47
|
-
const page = render(Component, {
|
|
48
|
-
...baseProps,
|
|
49
|
-
lead: "Key",
|
|
50
|
-
value: "Value",
|
|
51
|
-
});
|
|
52
|
-
await expect.element(page.getByText("Key")).toBeInTheDocument();
|
|
53
|
-
await expect.element(page.getByText("Value")).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
it("should render with an icon", async () => {
|
|
56
|
-
const icon = createRawSnippet(() => ({
|
|
57
|
-
render: () => `<div data-testid="custom-icon"></div>`,
|
|
58
|
-
}));
|
|
59
|
-
const page = render(Component, {
|
|
60
|
-
...baseProps,
|
|
61
|
-
value: "Icon Chip",
|
|
62
|
-
icon,
|
|
63
|
-
});
|
|
64
|
-
await expect.element(page.getByTestId("custom-icon")).toBeInTheDocument();
|
|
65
|
-
});
|
|
66
|
-
it("should apply custom class and modifiers", async () => {
|
|
67
|
-
const page = render(Component, {
|
|
68
|
-
...baseProps,
|
|
69
|
-
value: "Styled Chip",
|
|
70
|
-
class: "extra-class",
|
|
71
|
-
density: "dense",
|
|
72
|
-
severity: "caution",
|
|
73
|
-
});
|
|
74
|
-
await expect.element(componentLocator(page)).toHaveClass("extra-class");
|
|
75
|
-
await expect.element(componentLocator(page)).toHaveClass("dense");
|
|
76
|
-
await expect.element(componentLocator(page)).toHaveClass("caution");
|
|
77
|
-
});
|
|
78
|
-
it("should not render a button when dismiss is provided", async () => {
|
|
79
|
-
const page = render(Component, {
|
|
80
|
-
...baseProps,
|
|
81
|
-
value: "Dismissible",
|
|
82
|
-
ondismiss: () => { },
|
|
83
|
-
});
|
|
84
|
-
await expect
|
|
85
|
-
.element(componentLocator(page))
|
|
86
|
-
.not.toHaveAttribute("type", "button");
|
|
87
|
-
await expect
|
|
88
|
-
.element(page.getByRole("button"))
|
|
89
|
-
.toHaveAccessibleName("Dismiss");
|
|
90
|
-
});
|
|
91
|
-
it("should not render a button when readonly is provided", async () => {
|
|
92
|
-
const page = render(Component, {
|
|
93
|
-
...baseProps,
|
|
94
|
-
value: "Readonly",
|
|
95
|
-
readonly: true,
|
|
96
|
-
onclick: () => { },
|
|
97
|
-
});
|
|
98
|
-
await expect.element(componentLocator(page)).toBeInTheDocument();
|
|
99
|
-
await expect.element(page.getByRole("button")).not.toBeInTheDocument();
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
describe("Interactions & States", () => {
|
|
103
|
-
it("should render a working button when onclick is provided", async () => {
|
|
104
|
-
const onclick = vi.fn();
|
|
105
|
-
const page = render(Component, {
|
|
106
|
-
...baseProps,
|
|
107
|
-
value: "Clickable",
|
|
108
|
-
onclick,
|
|
109
|
-
});
|
|
110
|
-
const element = page.getByRole("button");
|
|
111
|
-
await expect.element(element).toBeInTheDocument();
|
|
112
|
-
await element.click();
|
|
113
|
-
expect(onclick).toHaveBeenCalled();
|
|
114
|
-
});
|
|
115
|
-
it("should render a working dismiss button when ondismiss is provided", async () => {
|
|
116
|
-
const ondismiss = vi.fn();
|
|
117
|
-
const page = render(Component, {
|
|
118
|
-
...baseProps,
|
|
119
|
-
value: "Dismissible",
|
|
120
|
-
ondismiss,
|
|
121
|
-
});
|
|
122
|
-
const dissmissButton = page.getByLabelText("Dismiss");
|
|
123
|
-
await expect.element(dissmissButton).toBeInTheDocument();
|
|
124
|
-
await expect.element(dissmissButton).toBeInTheDocument();
|
|
125
|
-
await dissmissButton.click();
|
|
126
|
-
expect(ondismiss).toHaveBeenCalled();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
function componentLocator(page) {
|
|
131
|
-
return page.getByTestId("chip");
|
|
132
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|