@politiet/sheriff-web-components 2.7.0 → 2.7.2
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/custom-elements.json +172 -7
- package/dist/frameworks/preact.d.ts +4 -1
- package/dist/frameworks/preact.d.ts.map +1 -1
- package/dist/frameworks/react.d.ts +10 -2
- package/dist/frameworks/react.d.ts.map +1 -1
- package/dist/frameworks/solidjs.d.ts +1 -0
- package/dist/frameworks/solidjs.d.ts.map +1 -1
- package/dist/frameworks/svelte.d.ts +1 -0
- package/dist/frameworks/svelte.d.ts.map +1 -1
- package/dist/frameworks/vue.d.ts +1 -0
- package/dist/frameworks/vue.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mixins/sds-dialog-target-mixin.d.ts +2 -0
- package/dist/mixins/sds-dialog-target-mixin.d.ts.map +1 -1
- package/dist/mixins/sds-dialog-target-mixin.js +31 -15
- package/dist/mixins/sds-dialog-target-mixin.js.map +1 -1
- package/dist/mixins/sds-popover-target-mixin.d.ts +1 -1
- package/dist/mixins/sds-popover-target-mixin.d.ts.map +1 -1
- package/dist/mixins/sds-popover-target-mixin.js.map +1 -1
- package/dist/react-wrappers/SDSPopoverWrapper.d.ts +4 -1
- package/dist/react-wrappers/SDSPopoverWrapper.d.ts.map +1 -1
- package/dist/react-wrappers/SDSPopoverWrapper.js +3 -1
- package/dist/react-wrappers/SDSPopoverWrapper.js.map +1 -1
- package/dist/react-wrappers/SDSTooltipWrapper.d.ts +6 -0
- package/dist/react-wrappers/SDSTooltipWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSTooltipWrapper.js +12 -0
- package/dist/react-wrappers/SDSTooltipWrapper.js.map +1 -0
- package/dist/react-wrappers/index.d.ts +1 -0
- package/dist/react-wrappers/index.d.ts.map +1 -1
- package/dist/react-wrappers/index.js +1 -0
- package/dist/react-wrappers/index.js.map +1 -1
- package/dist/sds-button/sds-button.component.d.ts +1 -1
- package/dist/sds-button/sds-button.component.d.ts.map +1 -1
- package/dist/sds-button/sds-button.component.js +1 -1
- package/dist/sds-button/sds-button.component.js.map +1 -1
- package/dist/sds-dialog/sds-dialog.component.js +1 -1
- package/dist/sds-dialog/sds-dialog.component.js.map +1 -1
- package/dist/sds-popover/assets/popover-styles.d.ts.map +1 -1
- package/dist/sds-popover/assets/popover-styles.js +1 -1
- package/dist/sds-popover/assets/popover-styles.js.map +1 -1
- package/dist/sds-popover/sds-popover.d.ts +3 -1
- package/dist/sds-popover/sds-popover.d.ts.map +1 -1
- package/dist/sds-popover/sds-popover.js +18 -4
- package/dist/sds-popover/sds-popover.js.map +1 -1
- package/dist/sds-tooltip/assets/tooltip-styles.d.ts +3 -0
- package/dist/sds-tooltip/assets/tooltip-styles.d.ts.map +1 -0
- package/dist/sds-tooltip/assets/tooltip-styles.js +3 -0
- package/dist/sds-tooltip/assets/tooltip-styles.js.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.d.ts +35 -0
- package/dist/sds-tooltip/sds-tooltip.d.ts.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.js +140 -0
- package/dist/sds-tooltip/sds-tooltip.js.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.styles.d.ts +2 -0
- package/dist/sds-tooltip/sds-tooltip.styles.d.ts.map +1 -0
- package/dist/sds-tooltip/sds-tooltip.styles.js +87 -0
- package/dist/sds-tooltip/sds-tooltip.styles.js.map +1 -0
- package/dist/shared/assets/positioning.js +1 -0
- package/dist/shared/positioning.d.ts +2 -0
- package/dist/shared/positioning.d.ts.map +1 -0
- package/dist/shared/positioning.js +2 -0
- package/dist/shared/positioning.js.map +1 -0
- package/dist/sheriff-web-components.js +284 -201
- package/package.json +10 -4
- package/web-types.json +260 -11
- package/dist/playwright-util/custom-matchers.d.ts +0 -7
- package/dist/playwright-util/custom-matchers.d.ts.map +0 -1
- package/dist/playwright-util/custom-matchers.js +0 -21
- package/dist/playwright-util/custom-matchers.js.map +0 -1
- package/dist/playwright-util/form.d.ts +0 -3
- package/dist/playwright-util/form.d.ts.map +0 -1
- package/dist/playwright-util/form.js +0 -44
- package/dist/playwright-util/form.js.map +0 -1
- package/dist/sds-button/sds-button.spec.d.ts +0 -2
- package/dist/sds-button/sds-button.spec.d.ts.map +0 -1
- package/dist/sds-button/sds-button.spec.js +0 -182
- package/dist/sds-button/sds-button.spec.js.map +0 -1
- package/dist/sds-checkbox/sds-checkbox.spec.d.ts +0 -2
- package/dist/sds-checkbox/sds-checkbox.spec.d.ts.map +0 -1
- package/dist/sds-checkbox/sds-checkbox.spec.js +0 -74
- package/dist/sds-checkbox/sds-checkbox.spec.js.map +0 -1
- package/dist/sds-dialog/sds-dialog.spec.d.ts +0 -2
- package/dist/sds-dialog/sds-dialog.spec.d.ts.map +0 -1
- package/dist/sds-dialog/sds-dialog.spec.js +0 -50
- package/dist/sds-dialog/sds-dialog.spec.js.map +0 -1
- package/dist/sds-popover/assets/positioning.js +0 -1
- package/dist/sds-radio/sds-radio.spec.d.ts +0 -2
- package/dist/sds-radio/sds-radio.spec.d.ts.map +0 -1
- package/dist/sds-radio/sds-radio.spec.js +0 -71
- package/dist/sds-radio/sds-radio.spec.js.map +0 -1
- package/dist/sds-textfield/sds-textfield.spec.d.ts +0 -2
- package/dist/sds-textfield/sds-textfield.spec.d.ts.map +0 -1
- package/dist/sds-textfield/sds-textfield.spec.js +0 -137
- package/dist/sds-textfield/sds-textfield.spec.js.map +0 -1
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test';
|
|
2
|
-
const primaryButtonIds = [
|
|
3
|
-
// Primary
|
|
4
|
-
'button-primary-large',
|
|
5
|
-
'button-primary-medium',
|
|
6
|
-
'button-primary-small',
|
|
7
|
-
'button-primary-disabled',
|
|
8
|
-
'button-primary-large-icon-before',
|
|
9
|
-
'button-primary-medium-icon-before',
|
|
10
|
-
'button-primary-small-icon-before',
|
|
11
|
-
'button-primary-disabled-icon-before',
|
|
12
|
-
'button-primary-large-icon-after',
|
|
13
|
-
'button-primary-medium-icon-after',
|
|
14
|
-
'button-primary-small-icon-after',
|
|
15
|
-
'button-primary-disabled-icon-after',
|
|
16
|
-
'button-primary-large-icon-only',
|
|
17
|
-
'button-primary-medium-icon-only',
|
|
18
|
-
'button-primary-small-icon-only',
|
|
19
|
-
'button-primary-disabled-icon-only',
|
|
20
|
-
];
|
|
21
|
-
const secondaryButtonIds = [
|
|
22
|
-
// Secondary
|
|
23
|
-
'button-secondary-large',
|
|
24
|
-
'button-secondary-medium',
|
|
25
|
-
'button-secondary-small',
|
|
26
|
-
'button-secondary-disabled',
|
|
27
|
-
'button-secondary-large-icon-before',
|
|
28
|
-
'button-secondary-medium-icon-before',
|
|
29
|
-
'button-secondary-small-icon-before',
|
|
30
|
-
'button-secondary-disabled-icon-before',
|
|
31
|
-
'button-secondary-large-icon-after',
|
|
32
|
-
'button-secondary-medium-icon-after',
|
|
33
|
-
'button-secondary-small-icon-after',
|
|
34
|
-
'button-secondary-disabled-icon-after',
|
|
35
|
-
'button-secondary-large-icon-only',
|
|
36
|
-
'button-secondary-medium-icon-only',
|
|
37
|
-
'button-secondary-small-icon-only',
|
|
38
|
-
'button-secondary-disabled-icon-only',
|
|
39
|
-
];
|
|
40
|
-
const tertiaryButtonIds = [
|
|
41
|
-
// Tertiary
|
|
42
|
-
'button-tertiary-large',
|
|
43
|
-
'button-tertiary-medium',
|
|
44
|
-
'button-tertiary-small',
|
|
45
|
-
'button-tertiary-disabled',
|
|
46
|
-
'button-tertiary-large-icon-before',
|
|
47
|
-
'button-tertiary-medium-icon-before',
|
|
48
|
-
'button-tertiary-small-icon-before',
|
|
49
|
-
'button-tertiary-disabled-icon-before',
|
|
50
|
-
'button-tertiary-large-icon-after',
|
|
51
|
-
'button-tertiary-medium-icon-after',
|
|
52
|
-
'button-tertiary-small-icon-after',
|
|
53
|
-
'button-tertiary-disabled-icon-after',
|
|
54
|
-
'button-tertiary-large-icon-only',
|
|
55
|
-
'button-tertiary-medium-icon-only',
|
|
56
|
-
'button-tertiary-small-icon-only',
|
|
57
|
-
'button-tertiary-disabled-icon-only',
|
|
58
|
-
];
|
|
59
|
-
const criticalButtonIds = [
|
|
60
|
-
// Critical
|
|
61
|
-
'button-critical-large',
|
|
62
|
-
'button-critical-medium',
|
|
63
|
-
'button-critical-small',
|
|
64
|
-
'button-critical-disabled',
|
|
65
|
-
'button-critical-large-icon-before',
|
|
66
|
-
'button-critical-medium-icon-before',
|
|
67
|
-
'button-critical-small-icon-before',
|
|
68
|
-
'button-critical-disabled-icon-before',
|
|
69
|
-
'button-critical-large-icon-after',
|
|
70
|
-
'button-critical-medium-icon-after',
|
|
71
|
-
'button-critical-small-icon-after',
|
|
72
|
-
'button-critical-disabled-icon-after',
|
|
73
|
-
'button-critical-large-icon-only',
|
|
74
|
-
'button-critical-medium-icon-only',
|
|
75
|
-
'button-critical-small-icon-only',
|
|
76
|
-
'button-critical-disabled-icon-only',
|
|
77
|
-
];
|
|
78
|
-
const dangerButtonIds = [
|
|
79
|
-
// Danger
|
|
80
|
-
'button-danger-primary-large',
|
|
81
|
-
'button-danger-primary-medium',
|
|
82
|
-
'button-danger-primary-small',
|
|
83
|
-
'button-danger-primary-disabled',
|
|
84
|
-
'button-danger-primary-large-icon-before',
|
|
85
|
-
'button-danger-primary-medium-icon-before',
|
|
86
|
-
'button-danger-primary-small-icon-before',
|
|
87
|
-
'button-danger-primary-disabled-icon-before',
|
|
88
|
-
'button-danger-primary-large-icon-after',
|
|
89
|
-
'button-danger-primary-medium-icon-after',
|
|
90
|
-
'button-danger-primary-small-icon-after',
|
|
91
|
-
'button-danger-primary-disabled-icon-after',
|
|
92
|
-
'button-danger-primary-large-icon-only',
|
|
93
|
-
'button-danger-primary-medium-icon-only',
|
|
94
|
-
'button-danger-primary-small-icon-only',
|
|
95
|
-
'button-danger-primary-disabled-icon-only',
|
|
96
|
-
'button-danger-secondary-large',
|
|
97
|
-
'button-danger-secondary-medium',
|
|
98
|
-
'button-danger-secondary-small',
|
|
99
|
-
'button-danger-secondary-disabled',
|
|
100
|
-
'button-danger-secondary-large-icon-before',
|
|
101
|
-
'button-danger-secondary-medium-icon-before',
|
|
102
|
-
'button-danger-secondary-small-icon-before',
|
|
103
|
-
'button-danger-secondary-disabled-icon-before',
|
|
104
|
-
'button-danger-secondary-large-icon-after',
|
|
105
|
-
'button-danger-secondary-medium-icon-after',
|
|
106
|
-
'button-danger-secondary-small-icon-after',
|
|
107
|
-
'button-danger-secondary-disabled-icon-after',
|
|
108
|
-
'button-danger-secondary-large-icon-only',
|
|
109
|
-
'button-danger-secondary-medium-icon-only',
|
|
110
|
-
'button-danger-secondary-small-icon-only',
|
|
111
|
-
'button-danger-secondary-disabled-icon-only',
|
|
112
|
-
'button-danger-tertiary-large',
|
|
113
|
-
'button-danger-tertiary-medium',
|
|
114
|
-
'button-danger-tertiary-small',
|
|
115
|
-
'button-danger-tertiary-disabled',
|
|
116
|
-
'button-danger-tertiary-large-icon-before',
|
|
117
|
-
'button-danger-tertiary-medium-icon-before',
|
|
118
|
-
'button-danger-tertiary-small-icon-before',
|
|
119
|
-
'button-danger-tertiary-disabled-icon-before',
|
|
120
|
-
'button-danger-tertiary-large-icon-after',
|
|
121
|
-
'button-danger-tertiary-medium-icon-after',
|
|
122
|
-
'button-danger-tertiary-small-icon-after',
|
|
123
|
-
'button-danger-tertiary-disabled-icon-after',
|
|
124
|
-
'button-danger-tertiary-large-icon-only',
|
|
125
|
-
'button-danger-tertiary-medium-icon-only',
|
|
126
|
-
'button-danger-tertiary-small-icon-only',
|
|
127
|
-
'button-danger-tertiary-disabled-icon-only',
|
|
128
|
-
];
|
|
129
|
-
test.describe('button-component', () => {
|
|
130
|
-
test.beforeEach(async ({ page }) => {
|
|
131
|
-
await page.goto('iframe.html?viewMode=docs&id=test-button--docs');
|
|
132
|
-
});
|
|
133
|
-
test('visibility', async ({ page }) => {
|
|
134
|
-
const buttonIds = [...primaryButtonIds, ...secondaryButtonIds, ...tertiaryButtonIds, ...criticalButtonIds, ...dangerButtonIds];
|
|
135
|
-
for (const id of buttonIds) {
|
|
136
|
-
await expect(page.locator(`#${id}`)).toBeVisible();
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
test.skip('design-implementation', async ({ page }) => {
|
|
140
|
-
const buttonIds = [...primaryButtonIds, ...secondaryButtonIds, ...tertiaryButtonIds, ...criticalButtonIds, ...dangerButtonIds];
|
|
141
|
-
await page.reload();
|
|
142
|
-
for (const id of buttonIds) {
|
|
143
|
-
// Default state
|
|
144
|
-
await expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}.png`);
|
|
145
|
-
// Hover state
|
|
146
|
-
page.locator(`#${id}`).hover();
|
|
147
|
-
await expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}-hover.png`);
|
|
148
|
-
// Focus state
|
|
149
|
-
await page.evaluate((id) => {
|
|
150
|
-
const element = document.getElementById(id);
|
|
151
|
-
if (element) {
|
|
152
|
-
const parentDiv = document.createElement('div');
|
|
153
|
-
parentDiv.style.padding = '10px';
|
|
154
|
-
parentDiv.style.backgroundColor = 'white';
|
|
155
|
-
element.parentNode?.insertBefore(parentDiv, element);
|
|
156
|
-
parentDiv.appendChild(element);
|
|
157
|
-
}
|
|
158
|
-
}, id);
|
|
159
|
-
page.locator(`#${id}`).focus();
|
|
160
|
-
const parentDiv = await page.locator(`#${id}`).locator('xpath=..');
|
|
161
|
-
await expect(parentDiv).toHaveScreenshot(`${id}-focus.png`);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
test('form-submission', async ({ page }) => {
|
|
165
|
-
let requestUrl;
|
|
166
|
-
page.on('request', (request) => {
|
|
167
|
-
if (request.url().includes('iframe.html?first-name=John')) {
|
|
168
|
-
requestUrl = new URL(request.url());
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
await page.locator('#first-name').pressSequentially('John');
|
|
172
|
-
await page.locator('#submit-button').click();
|
|
173
|
-
await expect(requestUrl?.searchParams.get('first-name')).toBe('John');
|
|
174
|
-
});
|
|
175
|
-
test('form-reset', async ({ page }) => {
|
|
176
|
-
await page.locator('#first-name').pressSequentially('John');
|
|
177
|
-
await page.locator('#reset-button').click();
|
|
178
|
-
const value = await page.locator('#first-name').getAttribute('value');
|
|
179
|
-
expect(value).toBeNull();
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
//# sourceMappingURL=sds-button.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-button.spec.js","sourceRoot":"","sources":["../../src/sds-button/sds-button.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,gBAAgB,GAAG;IACxB,UAAU;IACV,sBAAsB;IACtB,uBAAuB;IACvB,sBAAsB;IACtB,yBAAyB;IACzB,kCAAkC;IAClC,mCAAmC;IACnC,kCAAkC;IAClC,qCAAqC;IACrC,iCAAiC;IACjC,kCAAkC;IAClC,iCAAiC;IACjC,oCAAoC;IACpC,gCAAgC;IAChC,iCAAiC;IACjC,gCAAgC;IAChC,mCAAmC;CACnC,CAAC;AACF,MAAM,kBAAkB,GAAG;IAC1B,YAAY;IACZ,wBAAwB;IACxB,yBAAyB;IACzB,wBAAwB;IACxB,2BAA2B;IAC3B,oCAAoC;IACpC,qCAAqC;IACrC,oCAAoC;IACpC,uCAAuC;IACvC,mCAAmC;IACnC,oCAAoC;IACpC,mCAAmC;IACnC,sCAAsC;IACtC,kCAAkC;IAClC,mCAAmC;IACnC,kCAAkC;IAClC,qCAAqC;CACrC,CAAC;AACF,MAAM,iBAAiB,GAAG;IACzB,WAAW;IACX,uBAAuB;IACvB,wBAAwB;IACxB,uBAAuB;IACvB,0BAA0B;IAC1B,mCAAmC;IACnC,oCAAoC;IACpC,mCAAmC;IACnC,sCAAsC;IACtC,kCAAkC;IAClC,mCAAmC;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AiB,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACrC,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from '@playwright/test';\n\nconst primaryButtonIds = [\n\t// Primary\n\t'button-primary-large',\n\t'button-primary-medium',\n\t'button-primary-small',\n\t'button-primary-disabled',\n\t'button-primary-large-icon-before',\n\t'button-primary-medium-icon-before',\n\t'button-primary-small-icon-before',\n\t'button-primary-disabled-icon-before',\n\t'button-primary-large-icon-after',\n\t'button-primary-medium-icon-after',\n\t'button-primary-small-icon-after',\n\t'button-primary-disabled-icon-after',\n\t'button-primary-large-icon-only',\n\t'button-primary-medium-icon-only',\n\t'button-primary-small-icon-only',\n\t'button-primary-disabled-icon-only',\n];\nconst secondaryButtonIds = [\n\t// Secondary\n\t'button-secondary-large',\n\t'button-secondary-medium',\n\t'button-secondary-small',\n\t'button-secondary-disabled',\n\t'button-secondary-large-icon-before',\n\t'button-secondary-medium-icon-before',\n\t'button-secondary-small-icon-before',\n\t'button-secondary-disabled-icon-before',\n\t'button-secondary-large-icon-after',\n\t'button-secondary-medium-icon-after',\n\t'button-secondary-small-icon-after',\n\t'button-secondary-disabled-icon-after',\n\t'button-secondary-large-icon-only',\n\t'button-secondary-medium-icon-only',\n\t'button-secondary-small-icon-only',\n\t'button-secondary-disabled-icon-only',\n];\nconst tertiaryButtonIds = [\n\t// Tertiary\n\t'button-tertiary-large',\n\t'button-tertiary-medium',\n\t'button-tertiary-small',\n\t'button-tertiary-disabled',\n\t'button-tertiary-large-icon-before',\n\t'button-tertiary-medium-icon-before',\n\t'button-tertiary-small-icon-before',\n\t'button-tertiary-disabled-icon-before',\n\t'button-tertiary-large-icon-after',\n\t'button-tertiary-medium-icon-after',\n\t'button-tertiary-small-icon-after',\n\t'button-tertiary-disabled-icon-after',\n\t'button-tertiary-large-icon-only',\n\t'button-tertiary-medium-icon-only',\n\t'button-tertiary-small-icon-only',\n\t'button-tertiary-disabled-icon-only',\n];\nconst criticalButtonIds = [\n\t// Critical\n\t'button-critical-large',\n\t'button-critical-medium',\n\t'button-critical-small',\n\t'button-critical-disabled',\n\t'button-critical-large-icon-before',\n\t'button-critical-medium-icon-before',\n\t'button-critical-small-icon-before',\n\t'button-critical-disabled-icon-before',\n\t'button-critical-large-icon-after',\n\t'button-critical-medium-icon-after',\n\t'button-critical-small-icon-after',\n\t'button-critical-disabled-icon-after',\n\t'button-critical-large-icon-only',\n\t'button-critical-medium-icon-only',\n\t'button-critical-small-icon-only',\n\t'button-critical-disabled-icon-only',\n];\n\nconst dangerButtonIds = [\n\t// Danger\n\t'button-danger-primary-large',\n\t'button-danger-primary-medium',\n\t'button-danger-primary-small',\n\t'button-danger-primary-disabled',\n\t'button-danger-primary-large-icon-before',\n\t'button-danger-primary-medium-icon-before',\n\t'button-danger-primary-small-icon-before',\n\t'button-danger-primary-disabled-icon-before',\n\t'button-danger-primary-large-icon-after',\n\t'button-danger-primary-medium-icon-after',\n\t'button-danger-primary-small-icon-after',\n\t'button-danger-primary-disabled-icon-after',\n\t'button-danger-primary-large-icon-only',\n\t'button-danger-primary-medium-icon-only',\n\t'button-danger-primary-small-icon-only',\n\t'button-danger-primary-disabled-icon-only',\n\t'button-danger-secondary-large',\n\t'button-danger-secondary-medium',\n\t'button-danger-secondary-small',\n\t'button-danger-secondary-disabled',\n\t'button-danger-secondary-large-icon-before',\n\t'button-danger-secondary-medium-icon-before',\n\t'button-danger-secondary-small-icon-before',\n\t'button-danger-secondary-disabled-icon-before',\n\t'button-danger-secondary-large-icon-after',\n\t'button-danger-secondary-medium-icon-after',\n\t'button-danger-secondary-small-icon-after',\n\t'button-danger-secondary-disabled-icon-after',\n\t'button-danger-secondary-large-icon-only',\n\t'button-danger-secondary-medium-icon-only',\n\t'button-danger-secondary-small-icon-only',\n\t'button-danger-secondary-disabled-icon-only',\n\t'button-danger-tertiary-large',\n\t'button-danger-tertiary-medium',\n\t'button-danger-tertiary-small',\n\t'button-danger-tertiary-disabled',\n\t'button-danger-tertiary-large-icon-before',\n\t'button-danger-tertiary-medium-icon-before',\n\t'button-danger-tertiary-small-icon-before',\n\t'button-danger-tertiary-disabled-icon-before',\n\t'button-danger-tertiary-large-icon-after',\n\t'button-danger-tertiary-medium-icon-after',\n\t'button-danger-tertiary-small-icon-after',\n\t'button-danger-tertiary-disabled-icon-after',\n\t'button-danger-tertiary-large-icon-only',\n\t'button-danger-tertiary-medium-icon-only',\n\t'button-danger-tertiary-small-icon-only',\n\t'button-danger-tertiary-disabled-icon-only',\n];\n\ntest.describe('button-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto('iframe.html?viewMode=docs&id=test-button--docs');\n\t});\n\n\ttest('visibility', async ({ page }) => {\n\t\tconst buttonIds = [...primaryButtonIds, ...secondaryButtonIds, ...tertiaryButtonIds, ...criticalButtonIds, ...dangerButtonIds];\n\n\t\tfor (const id of buttonIds) {\n\t\t\tawait expect(page.locator(`#${id}`)).toBeVisible();\n\t\t}\n\t});\n\n\ttest.skip('design-implementation', async ({ page }) => {\n\t\tconst buttonIds = [...primaryButtonIds, ...secondaryButtonIds, ...tertiaryButtonIds, ...criticalButtonIds, ...dangerButtonIds];\n\t\tawait page.reload();\n\n\t\tfor (const id of buttonIds) {\n\t\t\t// Default state\n\t\t\tawait expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}.png`);\n\t\t\t// Hover state\n\t\t\tpage.locator(`#${id}`).hover();\n\t\t\tawait expect(page.locator(`#${id}`)).toHaveScreenshot(`${id}-hover.png`);\n\t\t\t// Focus state\n\t\t\tawait page.evaluate((id) => {\n\t\t\t\tconst element = document.getElementById(id);\n\t\t\t\tif (element) {\n\t\t\t\t\tconst parentDiv = document.createElement('div');\n\t\t\t\t\tparentDiv.style.padding = '10px';\n\t\t\t\t\tparentDiv.style.backgroundColor = 'white';\n\t\t\t\t\telement.parentNode?.insertBefore(parentDiv, element);\n\t\t\t\t\tparentDiv.appendChild(element);\n\t\t\t\t}\n\t\t\t}, id);\n\t\t\tpage.locator(`#${id}`).focus();\n\t\t\tconst parentDiv = await page.locator(`#${id}`).locator('xpath=..');\n\t\t\tawait expect(parentDiv).toHaveScreenshot(`${id}-focus.png`);\n\t\t}\n\t});\n\n\ttest('form-submission', async ({ page }) => {\n\t\tlet requestUrl: URL | undefined;\n\t\tpage.on('request', (request) => {\n\t\t\tif (request.url().includes('iframe.html?first-name=John')) {\n\t\t\t\trequestUrl = new URL(request.url());\n\t\t\t}\n\t\t});\n\n\t\tawait page.locator('#first-name').pressSequentially('John');\n\t\tawait page.locator('#submit-button').click();\n\t\tawait expect(requestUrl?.searchParams.get('first-name')).toBe('John');\n\t});\n\n\ttest('form-reset', async ({ page }) => {\n\t\tawait page.locator('#first-name').pressSequentially('John');\n\t\tawait page.locator('#reset-button').click();\n\t\tconst value = await page.locator('#first-name').getAttribute('value');\n\t\texpect(value).toBeNull();\n\t});\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-checkbox.spec.d.ts","sourceRoot":"","sources":["../../src/sds-checkbox/sds-checkbox.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { test } from '@playwright/test';
|
|
2
|
-
import { onFormSubmitCallback } from '../playwright-util/form';
|
|
3
|
-
import { expect } from '../playwright-util/custom-matchers';
|
|
4
|
-
test.describe('checkbox-component', () => {
|
|
5
|
-
test.beforeEach(async ({ page }) => {
|
|
6
|
-
await page.goto('iframe.html?viewMode=docs&id=test-checkbox--docs');
|
|
7
|
-
});
|
|
8
|
-
test('visibility', async ({ page }) => {
|
|
9
|
-
await expect(page.locator('#with-label')).toBeVisible();
|
|
10
|
-
await expect(page.locator('#unchecked')).toBeVisible();
|
|
11
|
-
await expect(page.locator('#checked')).toBeVisible();
|
|
12
|
-
await expect(page.locator('#custom-value')).toBeVisible();
|
|
13
|
-
await expect(page.locator('#disabled')).toBeVisible();
|
|
14
|
-
await expect(page.locator('#checked-disabled')).toBeVisible();
|
|
15
|
-
});
|
|
16
|
-
test('states', async ({ page }) => {
|
|
17
|
-
const checkboxWithLabel = page.locator('#with-label');
|
|
18
|
-
await expect(checkboxWithLabel).isNotChecked();
|
|
19
|
-
const uncheckedCheckbox = page.locator('#unchecked');
|
|
20
|
-
await expect(uncheckedCheckbox).isNotChecked();
|
|
21
|
-
const checkedCheckbox = page.locator('#checked');
|
|
22
|
-
await expect(checkedCheckbox).isChecked();
|
|
23
|
-
const disabledCheckbox = page.locator('#disabled');
|
|
24
|
-
await expect(disabledCheckbox).toHaveAttribute('disabled', '');
|
|
25
|
-
const checkedDisabledCheckbox = page.locator('#checked-disabled');
|
|
26
|
-
await expect(checkedDisabledCheckbox).isChecked();
|
|
27
|
-
await expect(checkedDisabledCheckbox).toHaveAttribute('disabled', '');
|
|
28
|
-
});
|
|
29
|
-
test('interaction', async ({ page }) => {
|
|
30
|
-
await page.getByLabel('Checkbox with label').click();
|
|
31
|
-
const checkboxWithLabel = page.locator('#with-label');
|
|
32
|
-
await expect(checkboxWithLabel).isChecked();
|
|
33
|
-
const uncheckedCheckbox = page.locator('#unchecked');
|
|
34
|
-
await uncheckedCheckbox.click();
|
|
35
|
-
await expect(uncheckedCheckbox).isChecked();
|
|
36
|
-
const checkedCheckbox = page.locator('#checked');
|
|
37
|
-
await checkedCheckbox.click();
|
|
38
|
-
await expect(checkedCheckbox).isNotChecked();
|
|
39
|
-
const disabledCheckbox = page.locator('#disabled');
|
|
40
|
-
await disabledCheckbox.click();
|
|
41
|
-
await expect(checkedCheckbox).isNotChecked();
|
|
42
|
-
const checkedDisabledCheckbox = page.locator('#checked-disabled');
|
|
43
|
-
await checkedDisabledCheckbox.click();
|
|
44
|
-
await expect(checkedDisabledCheckbox).isChecked();
|
|
45
|
-
});
|
|
46
|
-
test('form-submission', async ({ page }) => {
|
|
47
|
-
const getFormData = await onFormSubmitCallback(page, 'checkbox-form');
|
|
48
|
-
const checkboxGroupMember = page.locator('#group-member-1');
|
|
49
|
-
await checkboxGroupMember.click();
|
|
50
|
-
const checkboxGroupMember2 = page.locator('#group-member-2');
|
|
51
|
-
await checkboxGroupMember2.click();
|
|
52
|
-
const checkboxGroupMember3 = page.locator('#group-member-3');
|
|
53
|
-
await checkboxGroupMember3.click();
|
|
54
|
-
await page.locator('#submit-button').click();
|
|
55
|
-
await expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();
|
|
56
|
-
const formData = await getFormData();
|
|
57
|
-
expect(formData).toMatchObject({
|
|
58
|
-
checked: 'on',
|
|
59
|
-
'custom-value': 'custom-value',
|
|
60
|
-
'checkbox-group': ['option-1', 'option-2', 'option-3'],
|
|
61
|
-
});
|
|
62
|
-
expect(formData).not.toHaveProperty('unchecked');
|
|
63
|
-
expect(formData).not.toHaveProperty('disabled');
|
|
64
|
-
expect(formData).not.toHaveProperty('checked-disabled');
|
|
65
|
-
});
|
|
66
|
-
test('form-reset', async ({ page }) => {
|
|
67
|
-
await page.locator('#unchecked').click();
|
|
68
|
-
await page.locator('#checked').click();
|
|
69
|
-
await page.locator('#reset-button').click();
|
|
70
|
-
await expect(page.locator('#unchecked')).isNotChecked();
|
|
71
|
-
await expect(page.locator('#checked')).isChecked();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=sds-checkbox.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-checkbox.spec.js","sourceRoot":"","sources":["../../src/sds-checkbox/sds-checkbox.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACxC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,IAAI,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACrC,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACxD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACvD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACrD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACtD,MAAM,MAAM,CAAC,IAAI,C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sourcesContent":["import { test } from '@playwright/test';\nimport { onFormSubmitCallback } from '../playwright-util/form';\nimport { expect } from '../playwright-util/custom-matchers';\n\ntest.describe('checkbox-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto('iframe.html?viewMode=docs&id=test-checkbox--docs');\n\t});\n\n\ttest('visibility', async ({ page }) => {\n\t\tawait expect(page.locator('#with-label')).toBeVisible();\n\t\tawait expect(page.locator('#unchecked')).toBeVisible();\n\t\tawait expect(page.locator('#checked')).toBeVisible();\n\t\tawait expect(page.locator('#custom-value')).toBeVisible();\n\t\tawait expect(page.locator('#disabled')).toBeVisible();\n\t\tawait expect(page.locator('#checked-disabled')).toBeVisible();\n\t});\n\n\ttest('states', async ({ page }) => {\n\t\tconst checkboxWithLabel = page.locator('#with-label');\n\t\tawait expect(checkboxWithLabel).isNotChecked();\n\n\t\tconst uncheckedCheckbox = page.locator('#unchecked');\n\t\tawait expect(uncheckedCheckbox).isNotChecked();\n\n\t\tconst checkedCheckbox = page.locator('#checked');\n\t\tawait expect(checkedCheckbox).isChecked();\n\n\t\tconst disabledCheckbox = page.locator('#disabled');\n\t\tawait expect(disabledCheckbox).toHaveAttribute('disabled', '');\n\n\t\tconst checkedDisabledCheckbox = page.locator('#checked-disabled');\n\t\tawait expect(checkedDisabledCheckbox).isChecked();\n\t\tawait expect(checkedDisabledCheckbox).toHaveAttribute('disabled', '');\n\t});\n\n\ttest('interaction', async ({ page }) => {\n\t\tawait page.getByLabel('Checkbox with label').click();\n\t\tconst checkboxWithLabel = page.locator('#with-label');\n\t\tawait expect(checkboxWithLabel).isChecked();\n\n\t\tconst uncheckedCheckbox = page.locator('#unchecked');\n\t\tawait uncheckedCheckbox.click();\n\t\tawait expect(uncheckedCheckbox).isChecked();\n\n\t\tconst checkedCheckbox = page.locator('#checked');\n\t\tawait checkedCheckbox.click();\n\t\tawait expect(checkedCheckbox).isNotChecked();\n\n\t\tconst disabledCheckbox = page.locator('#disabled');\n\t\tawait disabledCheckbox.click();\n\t\tawait expect(checkedCheckbox).isNotChecked();\n\n\t\tconst checkedDisabledCheckbox = page.locator('#checked-disabled');\n\t\tawait checkedDisabledCheckbox.click();\n\t\tawait expect(checkedDisabledCheckbox).isChecked();\n\t});\n\n\ttest('form-submission', async ({ page }) => {\n\t\tconst getFormData = await onFormSubmitCallback(page, 'checkbox-form');\n\n\t\tconst checkboxGroupMember = page.locator('#group-member-1');\n\t\tawait checkboxGroupMember.click();\n\n\t\tconst checkboxGroupMember2 = page.locator('#group-member-2');\n\t\tawait checkboxGroupMember2.click();\n\n\t\tconst checkboxGroupMember3 = page.locator('#group-member-3');\n\t\tawait checkboxGroupMember3.click();\n\n\t\tawait page.locator('#submit-button').click();\n\n\t\tawait expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();\n\t\tconst formData = await getFormData();\n\n\t\texpect(formData).toMatchObject({\n\t\t\tchecked: 'on',\n\t\t\t'custom-value': 'custom-value',\n\t\t\t'checkbox-group': ['option-1', 'option-2', 'option-3'],\n\t\t});\n\t\texpect(formData).not.toHaveProperty('unchecked');\n\t\texpect(formData).not.toHaveProperty('disabled');\n\t\texpect(formData).not.toHaveProperty('checked-disabled');\n\t});\n\n\ttest('form-reset', async ({ page }) => {\n\t\tawait page.locator('#unchecked').click();\n\t\tawait page.locator('#checked').click();\n\n\t\tawait page.locator('#reset-button').click();\n\n\t\tawait expect(page.locator('#unchecked')).isNotChecked();\n\t\tawait expect(page.locator('#checked')).isChecked();\n\t});\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-dialog.spec.d.ts","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { test, expect } from '@playwright/test';
|
|
2
|
-
test.describe('dialog-component', () => {
|
|
3
|
-
test.describe('commandfor', () => {
|
|
4
|
-
test.beforeEach(async ({ page }) => {
|
|
5
|
-
await page.goto('iframe.html?id=komponenter-dialog--dialog');
|
|
6
|
-
});
|
|
7
|
-
test('sets aria-haspopup on the trigger button', async ({ page }) => {
|
|
8
|
-
const innerButton = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]').locator('button');
|
|
9
|
-
await expect(innerButton).toHaveAttribute('aria-haspopup', 'dialog');
|
|
10
|
-
});
|
|
11
|
-
test('sets aria-controls on the trigger button', async ({ page }) => {
|
|
12
|
-
const innerButton = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]').locator('button');
|
|
13
|
-
await expect(innerButton).toHaveAttribute('aria-controls', 'dialog-example');
|
|
14
|
-
});
|
|
15
|
-
test('aria-expanded is false before opening', async ({ page }) => {
|
|
16
|
-
const innerButton = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]').locator('button');
|
|
17
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'false');
|
|
18
|
-
});
|
|
19
|
-
test('clicking the trigger opens the dialog', async ({ page }) => {
|
|
20
|
-
const trigger = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]');
|
|
21
|
-
const dialog = page.locator('sds-dialog#dialog-example');
|
|
22
|
-
await trigger.click();
|
|
23
|
-
await expect(dialog).toHaveAttribute('open');
|
|
24
|
-
});
|
|
25
|
-
test('aria-expanded is true when dialog is open', async ({ page }) => {
|
|
26
|
-
const trigger = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]');
|
|
27
|
-
const innerButton = trigger.locator('button');
|
|
28
|
-
await trigger.click();
|
|
29
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'true');
|
|
30
|
-
});
|
|
31
|
-
test('closing via command="close" resets aria-expanded', async ({ page }) => {
|
|
32
|
-
const trigger = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]');
|
|
33
|
-
const innerButton = trigger.locator('button');
|
|
34
|
-
await trigger.click();
|
|
35
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'true');
|
|
36
|
-
const closeButton = page.locator('sds-dialog#dialog-example sds-button[slot="footer"][command="close"]');
|
|
37
|
-
await closeButton.click();
|
|
38
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'false');
|
|
39
|
-
});
|
|
40
|
-
test('closing via ESC resets aria-expanded', async ({ page }) => {
|
|
41
|
-
const trigger = page.locator('sds-button[commandfor="dialog-example"][command="show-modal"]');
|
|
42
|
-
const innerButton = trigger.locator('button');
|
|
43
|
-
await trigger.click();
|
|
44
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'true');
|
|
45
|
-
await page.keyboard.press('Escape');
|
|
46
|
-
await expect(innerButton).toHaveAttribute('aria-expanded', 'false');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=sds-dialog.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-dialog.spec.js","sourceRoot":"","sources":["../../src/sds-dialog/sds-dialog.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEhD,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACtC,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAChC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAClC,MAAM,IAAI,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,0CAA0C,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnE,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,+DAA+D,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpH,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,0C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for', () => {\n\t\ttest.beforeEach(async ({ page }) => {\n\t\t\tawait page.goto('iframe.html?id=komponenter-dialog--dialog');\n\t\t});\n\n\t\ttest('sets aria-haspopup on the trigger button', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-haspopup', 'dialog');\n\t\t});\n\n\t\ttest('sets aria-controls on the trigger button', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-controls', 'dialog-example');\n\t\t});\n\n\t\ttest('aria-expanded is false before opening', async ({ page }) => {\n\t\t\tconst innerButton = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]').locator('button');\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\n\t\ttest('clicking the trigger opens the dialog', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst dialog = page.locator('sds-dialog#dialog-example');\n\n\t\t\tawait trigger.click();\n\n\t\t\tawait expect(dialog).toHaveAttribute('open');\n\t\t});\n\n\t\ttest('aria-expanded is true when dialog is open', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\t\t});\n\n\t\ttest('closing via command=\"close\" resets aria-expanded', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\n\t\t\tconst closeButton = page.locator('sds-dialog#dialog-example sds-button[slot=\"footer\"][command=\"close\"]');\n\t\t\tawait closeButton.click();\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\n\t\ttest('closing via ESC resets aria-expanded', async ({ page }) => {\n\t\t\tconst trigger = page.locator('sds-button[commandfor=\"dialog-example\"][command=\"show-modal\"]');\n\t\t\tconst innerButton = trigger.locator('button');\n\n\t\t\tawait trigger.click();\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'true');\n\n\t\t\tawait page.keyboard.press('Escape');\n\n\t\t\tawait expect(innerButton).toHaveAttribute('aria-expanded', 'false');\n\t\t});\n\t});\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const t={passive:!0,capture:!0},e=(t,e,n)=>void 0===n?t.getAttribute(e)??null:(null===n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n),null),n=(t,...e)=>{let[n,...i]=e;for(let e of n.split(" "))t.addEventListener(e,...i);return()=>o(t,...e)},o=(t,...e)=>{let[n,...o]=e;for(let e of n.split(" "))t.removeEventListener(e,...o)};Date.now().toString(36),Math.random().toString(36).slice(2,5);const i=Math.min,r=Math.max,l=Math.round,s=Math.floor,a=t=>({x:t,y:t}),c={left:"right",right:"left",bottom:"top",top:"bottom"},f={start:"end",end:"start"};function u(t,e,n){return r(t,i(e,n))}function d(t,e){return"function"==typeof t?t(e):t}function h(t){return t.split("-")[0]}function m(t){return t.split("-")[1]}function p(t){return"x"===t?"y":"x"}function g(t){return"y"===t?"height":"width"}const y=new Set(["top","bottom"]);function w(t){return y.has(h(t))?"y":"x"}function x(t){return p(w(t))}function v(t){return t.replace(/start|end/g,t=>f[t])}const b=["left","right"],R=["right","left"],A=["top","bottom"],L=["bottom","top"];function T(t,e,n,o){const i=m(t);let r=function(t,e,n){switch(t){case"top":case"bottom":return n?e?R:b:e?b:R;case"left":case"right":return e?A:L;default:return[]}}(h(t),"start"===n,o);return i&&(r=r.map(t=>t+"-"+i),e&&(r=r.concat(r.map(v)))),r}function S(t){return t.replace(/left|right|bottom|top/g,t=>c[t])}function E(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function C(t,e,n){let{reference:o,floating:i}=t;const r=w(e),l=x(e),s=g(l),a=h(e),c="y"===r,f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,d=o[s]/2-i[s]/2;let p;switch(a){case"top":p={x:f,y:o.y-i.height};break;case"bottom":p={x:f,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y}}switch(m(e)){case"start":p[l]-=d*(n&&c?-1:1);break;case"end":p[l]+=d*(n&&c?-1:1)}return p}async function D(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=d(e,t),p=function(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}(m),g=s[h?"floating"===u?"reference":"floating":u],y=E(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:a})),w="floating"===u?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,x=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),v=await(null==r.isElement?void 0:r.isElement(x))&&await(null==r.getScale?void 0:r.getScale(x))||{x:1,y:1},b=E(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:a}):w);return{top:(y.top-b.top+p.top)/v.y,bottom:(b.bottom-y.bottom+p.bottom)/v.y,left:(y.left-b.left+p.left)/v.x,right:(b.right-y.right+p.right)/v.x}}const O=new Set(["left","top"]);function P(){return"undefined"!=typeof window}function H(t){return W(t)?(t.nodeName||"").toLowerCase():"#document"}function F(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function M(t){var e;return null==(e=(W(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function W(t){return!!P()&&(t instanceof Node||t instanceof F(t).Node)}function k(t){return!!P()&&(t instanceof Element||t instanceof F(t).Element)}function B(t){return!!P()&&(t instanceof HTMLElement||t instanceof F(t).HTMLElement)}function $(t){return!(!P()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof F(t).ShadowRoot)}const V=new Set(["inline","contents"]);function _(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=U(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!V.has(i)}const z=new Set(["table","td","th"]);function N(t){return z.has(H(t))}const q=[":popover-open",":modal"];function I(t){return q.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const j=["transform","translate","scale","rotate","perspective"],X=["transform","translate","scale","rotate","perspective","filter"],Y=["paint","layout","strict","content"];function G(t){const e=J(),n=k(t)?U(t):t;return j.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||X.some(t=>(n.willChange||"").includes(t))||Y.some(t=>(n.contain||"").includes(t))}function J(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const K=new Set(["html","body","#document"]);function Q(t){return K.has(H(t))}function U(t){return F(t).getComputedStyle(t)}function Z(t){return k(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function tt(t){if("html"===H(t))return t;const e=t.assignedSlot||t.parentNode||$(t)&&t.host||M(t);return $(e)?e.host:e}function et(t){const e=tt(t);return Q(e)?t.ownerDocument?t.ownerDocument.body:t.body:B(e)&&_(e)?e:et(e)}function nt(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=et(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=F(i);if(r){const t=ot(l);return e.concat(l,l.visualViewport||[],_(i)?i:[],t&&n?nt(t):[])}return e.concat(i,nt(i,[],n))}function ot(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function it(t){const e=U(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=B(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,a=l(n)!==r||l(o)!==s;return a&&(n=r,o=s),{width:n,height:o,$:a}}function rt(t){return k(t)?t:t.contextElement}function lt(t){const e=rt(t);if(!B(e))return a(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=it(e);let s=(r?l(n.width):n.width)/o,c=(r?l(n.height):n.height)/i;return s&&Number.isFinite(s)||(s=1),c&&Number.isFinite(c)||(c=1),{x:s,y:c}}const st=a(0);function at(t){const e=F(t);return J()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:st}function ct(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),r=rt(t);let l=a(1);e&&(o?k(o)&&(l=lt(o)):l=lt(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==F(t))&&e}(r,n,o)?at(r):a(0);let c=(i.left+s.x)/l.x,f=(i.top+s.y)/l.y,u=i.width/l.x,d=i.height/l.y;if(r){const t=F(r),e=o&&k(o)?F(o):o;let n=t,i=ot(n);for(;i&&o&&e!==n;){const t=lt(i),e=i.getBoundingClientRect(),o=U(i),r=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;c*=t.x,f*=t.y,u*=t.x,d*=t.y,c+=r,f+=l,n=F(i),i=ot(n)}}return E({width:u,height:d,x:c,y:f})}function ft(t,e){const n=Z(t).scrollLeft;return e?e.left+n:ct(M(t)).left+n}function ut(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-ft(t,n),y:n.top+e.scrollTop}}const dt=new Set(["absolute","fixed"]);function ht(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=F(t),o=M(t),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,a=0;if(i){r=i.width,l=i.height;const t=J();(!t||t&&"fixed"===e)&&(s=i.offsetLeft,a=i.offsetTop)}const c=ft(o);if(c<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),i="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-i);l<=25&&(r-=l)}else c<=25&&(r+=c);return{width:r,height:l,x:s,y:a}}(t,n);else if("document"===e)o=function(t){const e=M(t),n=Z(t),o=t.ownerDocument.body,i=r(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),l=r(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+ft(t);const a=-n.scrollTop;return"rtl"===U(o).direction&&(s+=r(e.clientWidth,o.clientWidth)-i),{width:i,height:l,x:s,y:a}}(M(t));else if(k(e))o=function(t,e){const n=ct(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=B(t)?lt(t):a(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(e,n);else{const n=at(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return E(o)}function mt(t,e){const n=tt(t);return!(n===e||!k(n)||Q(n))&&("fixed"===U(n).position||mt(n,e))}function pt(t,e,n){const o=B(e),i=M(e),r="fixed"===n,l=ct(t,!0,r,e);let s={scrollLeft:0,scrollTop:0};const c=a(0);function f(){c.x=ft(i)}if(o||!o&&!r)if(("body"!==H(e)||_(i))&&(s=Z(e)),o){const t=ct(e,!0,r,e);c.x=t.x+e.clientLeft,c.y=t.y+e.clientTop}else i&&f();r&&!o&&i&&f();const u=!i||o||r?a(0):ut(i,s);return{x:l.left+s.scrollLeft-c.x-u.x,y:l.top+s.scrollTop-c.y-u.y,width:l.width,height:l.height}}function gt(t){return"static"===U(t).position}function yt(t,e){if(!B(t)||"fixed"===U(t).position)return null;if(e)return e(t);let n=t.offsetParent;return M(t)===n&&(n=n.ownerDocument.body),n}function wt(t,e){const n=F(t);if(I(t))return n;if(!B(t)){let e=tt(t);for(;e&&!Q(e);){if(k(e)&&!gt(e))return e;e=tt(e)}return n}let o=yt(t,e);for(;o&&N(o)&>(o);)o=yt(o,e);return o&&Q(o)&>(o)&&!G(o)?n:o||function(t){let e=tt(t);for(;B(e)&&!Q(e);){if(G(e))return e;if(I(e))return null;e=tt(e)}return null}(t)||n}const xt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r="fixed"===i,l=M(o),s=!!e&&I(e.floating);if(o===l||s&&r)return n;let c={scrollLeft:0,scrollTop:0},f=a(1);const u=a(0),d=B(o);if((d||!d&&!r)&&(("body"!==H(o)||_(l))&&(c=Z(o)),B(o))){const t=ct(o);f=lt(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop}const h=!l||d||r?a(0):ut(l,c);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-c.scrollTop*f.y+u.y+h.y}},getDocumentElement:M,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:l}=t;const s=[..."clippingAncestors"===n?I(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=nt(t,[],!1).filter(t=>k(t)&&"body"!==H(t)),i=null;const r="fixed"===U(t).position;let l=r?tt(t):t;for(;k(l)&&!Q(l);){const e=U(l),n=G(l);n||"fixed"!==e.position||(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&dt.has(i.position)||_(l)&&!n&&mt(t,l))?o=o.filter(t=>t!==l):i=e,l=tt(l)}return e.set(t,o),o}(e,this._c):[].concat(n),o],a=s[0],c=s.reduce((t,n)=>{const o=ht(e,n,l);return t.top=r(o.top,t.top),t.right=i(o.right,t.right),t.bottom=i(o.bottom,t.bottom),t.left=r(o.left,t.left),t},ht(e,a,l));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:wt,getElementRects:async function(t){const e=this.getOffsetParent||wt,n=this.getDimensions,o=await n(t.floating);return{reference:pt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=it(t);return{width:e,height:n}},getScale:lt,isElement:k,isRTL:function(t){return"rtl"===U(t).direction}};function vt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bt(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:l=!0,ancestorResize:a=!0,elementResize:c="function"==typeof ResizeObserver,layoutShift:f="function"==typeof IntersectionObserver,animationFrame:u=!1}=o,d=rt(t),h=l||a?[...d?nt(d):[],...nt(e)]:[];h.forEach(t=>{l&&t.addEventListener("scroll",n,{passive:!0}),a&&t.addEventListener("resize",n)});const m=d&&f?function(t,e){let n,o=null;const l=M(t);function a(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function c(f,u){void 0===f&&(f=!1),void 0===u&&(u=1),a();const d=t.getBoundingClientRect(),{left:h,top:m,width:p,height:g}=d;if(f||e(),!p||!g)return;const y={rootMargin:-s(m)+"px "+-s(l.clientWidth-(h+p))+"px "+-s(l.clientHeight-(m+g))+"px "+-s(h)+"px",threshold:r(0,i(1,u))||1};let w=!0;function x(e){const o=e[0].intersectionRatio;if(o!==u){if(!w)return c();o?c(!1,o):n=setTimeout(()=>{c(!1,1e-7)},1e3)}1!==o||vt(d,t.getBoundingClientRect())||c(),w=!1}try{o=new IntersectionObserver(x,{...y,root:l.ownerDocument})}catch(t){o=new IntersectionObserver(x,y)}o.observe(t)}(!0),a}(d,n):null;let p,g=-1,y=null;c&&(y=new ResizeObserver(t=>{let[o]=t;o&&o.target===d&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var t;null==(t=y)||t.observe(e)})),n()}),d&&!u&&y.observe(d),y.observe(e));let w=u?ct(t):null;return u&&function e(){const o=ct(t);w&&!vt(w,o)&&n();w=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;h.forEach(t=>{l&&t.removeEventListener("scroll",n),a&&t.removeEventListener("resize",n)}),null==m||m(),null==(t=y)||t.disconnect(),y=null,u&&cancelAnimationFrame(p)}}const Rt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=e,a=await async function(t,e){const{placement:n,platform:o,elements:i}=t,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),l=h(n),s=m(n),a="y"===w(n),c=O.has(l)?-1:1,f=r&&a?-1:1,u=d(e,t);let{mainAxis:p,crossAxis:g,alignmentAxis:y}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof y&&(g="end"===s?-1*y:y),a?{x:g*f,y:p*c}:{x:p*c,y:g*f}}(e,t);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:l}}}}},At=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:r}=e,{mainAxis:l=!0,crossAxis:s=!1,limiter:a={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...c}=d(t,e),f={x:n,y:o},m=await r.detectOverflow(e,c),g=w(h(i)),y=p(g);let x=f[y],v=f[g];if(l){const t="y"===y?"bottom":"right";x=u(x+m["y"===y?"top":"left"],x,x-m[t])}if(s){const t="y"===g?"bottom":"right";v=u(v+m["y"===g?"top":"left"],v,v-m[t])}const b=a.fn({...e,[y]:x,[g]:v});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[y]:l,[g]:s}}}}}},Lt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:a,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:R=!0,...A}=d(t,e);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const L=h(i),E=w(s),C=h(s)===s,D=await(null==a.isRTL?void 0:a.isRTL(c.floating)),O=p||(C||!R?[S(s)]:function(t){const e=S(t);return[v(t),e,v(e)]}(s)),P="none"!==b;!p&&P&&O.push(...T(s,R,b,D));const H=[s,...O],F=await a.detectOverflow(e,A),M=[];let W=(null==(o=r.flip)?void 0:o.overflows)||[];if(f&&M.push(F[L]),u){const t=function(t,e,n){void 0===n&&(n=!1);const o=m(t),i=x(t),r=g(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(l=S(l)),[l,S(l)]}(i,l,D);M.push(F[t[0]],F[t[1]])}if(W=[...W,{placement:i,overflows:M}],!M.every(t=>t<=0)){var k,B;const t=((null==(k=r.flip)?void 0:k.index)||0)+1,e=H[t];if(e){if(!("alignment"===u&&E!==w(e))||W.every(t=>w(t.placement)!==E||t.overflows[0]>0))return{data:{index:t,overflows:W},reset:{placement:e}}}let n=null==(B=W.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:B.placement;if(!n)switch(y){case"bestFit":{var $;const t=null==($=W.filter(t=>{if(P){const e=w(t.placement);return e===E||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:$[0];t&&(n=t);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},Tt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:l,rects:s,platform:a,elements:c}=e,{apply:f=()=>{},...u}=d(t,e),p=await a.detectOverflow(e,u),g=h(l),y=m(l),x="y"===w(l),{width:v,height:b}=s.floating;let R,A;"top"===g||"bottom"===g?(R=g,A=y===(await(null==a.isRTL?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(A=g,R="end"===y?"top":"bottom");const L=b-p.top-p.bottom,T=v-p.left-p.right,S=i(b-p[R],L),E=i(v-p[A],T),C=!e.middlewareData.shift;let D=S,O=E;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(O=T),null!=(o=e.middlewareData.shift)&&o.enabled.y&&(D=L),C&&!y){const t=r(p.left,0),e=r(p.right,0),n=r(p.top,0),o=r(p.bottom,0);x?O=v-2*(0!==t||0!==e?t+e:r(p.left,p.right)):D=b-2*(0!==n||0!==o?n+o:r(p.top,p.bottom))}await f({...e,availableWidth:O,availableHeight:D});const P=await a.getDimensions(c.floating);return v!==P.width||b!==P.height?{reset:{rects:!0}}:{}}}},St=function(t){return void 0===t&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:r,middlewareData:l}=e,{offset:s=0,mainAxis:a=!0,crossAxis:c=!0}=d(t,e),f={x:n,y:o},u=w(i),m=p(u);let g=f[m],y=f[u];const x=d(s,e),v="number"==typeof x?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(a){const t="y"===m?"height":"width",e=r.reference[m]-r.floating[t]+v.mainAxis,n=r.reference[m]+r.reference[t]-v.mainAxis;g<e?g=e:g>n&&(g=n)}if(c){var b,R;const t="y"===m?"width":"height",e=O.has(h(i)),n=r.reference[u]-r.floating[t]+(e&&(null==(b=l.offset)?void 0:b[u])||0)+(e?0:v.crossAxis),o=r.reference[u]+r.reference[t]+(e?0:(null==(R=l.offset)?void 0:R[u])||0)-(e?v.crossAxis:0);y<n?y=n:y>o&&(y=o)}return{[m]:g,[u]:y}}}},Et=(t,e,n)=>{const o=new Map,i={platform:xt,...n},r={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let c=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=C(c,o,a),d=o,h={},m=0;for(let n=0;n<s.length;n++){var p;const{name:r,fn:g}=s[n],{x:y,y:w,data:x,reset:v}=await g({x:f,y:u,initialPlacement:o,placement:d,strategy:i,middlewareData:h,rects:c,platform:{...l,detectOverflow:null!=(p=l.detectOverflow)?p:D},elements:{reference:t,floating:e}});f=null!=y?y:f,u=null!=w?w:u,h={...h,[r]:{...h[r],...x}},v&&m<=50&&(m++,"object"==typeof v&&(v.placement&&(d=v.placement),v.rects&&(c=!0===v.rects?await l.getElementRects({reference:t,floating:e,strategy:i}):v.rects),({x:f,y:u}=C(c,d,a))),n=-1)}return{x:f,y:u,placement:d,strategy:i,middlewareData:h}})(t,e,{...i,platform:r})},Ct="data-placement",Dt="data-autoplacement",Ot=new Map;function Pt(t){let{newState:n,oldState:o,target:i,source:r=t.detail}=t,l=i instanceof HTMLElement&&Mt(i,"--_ds-floating");if(!l)return;if("closed"===n)return Ot.get(i)?.();if(!r){let t=i.getRootNode(),e=`[popovertarget="${i.id}"],[commandfor="${i.id}"]`;r=i.id&&t?.querySelector?.(e)||void 0}if(!r||r===i||o&&o===n)return;let s=Mt(i,"--_ds-floating-overscroll"),a=e(i,Ct)||e(r,Ct)||l,c=e(i,Dt)||e(r,Dt),f=parseFloat(getComputedStyle(i,"::before").height)||0,u=a.match(/left|right/gi)?"Height":"Width",d=r[`offset${u}`]/2+f;if("none"===a)return;let h={strategy:"absolute",placement:a,middleware:[Rt(f||0),At({padding:10,limiter:St({offset:{mainAxis:d}})}),Wt(),..."false"===c?[]:[Lt({padding:10,crossAxis:!1})],...s?[Tt({apply({availableHeight:t}){"fit"===s&&(i.style.width=`${r.clientWidth}px`),i.style.maxHeight=`${Math.max(50,t-20)}px`}})]:[]]},m=bt(r,i,async()=>{if(!r?.isConnected)return Ot.get(i)?.();let{x:t,y:e}=await Et(r,i,h);i.style.translate=`${t}px ${e}px`});Ot.set(i,()=>Ot.delete(i)&&m())}let Ht;const Ft=({type:t})=>{if("mousedown"===t&&(Ht=!1),"scroll"===t&&!1===Ht&&(Ht=!0),"mouseup"===t&&Ht)for(let[t]of Ot)t.showPopover()};((t,e)=>{typeof window<"u"&&typeof document<"u"&&(window._dsHotReloadCleanup||(window._dsHotReloadCleanup=new Map),window._dsHotReloadCleanup?.get(t)?.map(t=>t()),window._dsHotReloadCleanup?.set(t,e()))})("popover",()=>[n(document,"mousedown scroll mouseup",Ft,!0),n(document,"toggle ds-toggle-source",Pt,t)]);const Mt=(t,e)=>getComputedStyle(t).getPropertyValue(e).trim(),Wt=()=>({name:"arrowPseudo",fn(t){let n=t.elements.floating,o=t.rects.reference,i=`${Math.round(o.width/2+o.x-t.x)}px`,r=`${Math.round(o.height/2+o.y-t.y)}px`;return n.style.setProperty("--_ds-floating-arrow-x",i),n.style.setProperty("--_ds-floating-arrow-y",r),e(n,"data-floating",t.placement),t}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio.spec.d.ts","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { test } from '@playwright/test';
|
|
2
|
-
import { onFormSubmitCallback } from '../playwright-util/form';
|
|
3
|
-
import { expect } from '../playwright-util/custom-matchers';
|
|
4
|
-
test.describe('radio-component', () => {
|
|
5
|
-
test.beforeEach(async ({ page }) => {
|
|
6
|
-
await page.goto('iframe.html?viewMode=docs&id=test-radio--docs');
|
|
7
|
-
});
|
|
8
|
-
test('visibility', async ({ page }) => {
|
|
9
|
-
await expect(page.locator('#with-label')).toBeVisible();
|
|
10
|
-
await expect(page.locator('#unchecked')).toBeVisible();
|
|
11
|
-
await expect(page.locator('#checked')).toBeVisible();
|
|
12
|
-
await expect(page.locator('#custom-value')).toBeVisible();
|
|
13
|
-
await expect(page.locator('#disabled')).toBeVisible();
|
|
14
|
-
await expect(page.locator('#checked-disabled')).toBeVisible();
|
|
15
|
-
});
|
|
16
|
-
test('states', async ({ page }) => {
|
|
17
|
-
const radioWithLabel = page.locator('#with-label');
|
|
18
|
-
await expect(radioWithLabel).isNotChecked();
|
|
19
|
-
const uncheckedRadio = page.locator('#unchecked');
|
|
20
|
-
await expect(uncheckedRadio).isNotChecked();
|
|
21
|
-
const checkedRadio = page.locator('#checked');
|
|
22
|
-
await expect(checkedRadio).isChecked();
|
|
23
|
-
const disabledRadio = page.locator('#disabled');
|
|
24
|
-
await expect(disabledRadio).toHaveAttribute('disabled', '');
|
|
25
|
-
const checkedDisabledRadio = page.locator('#checked-disabled');
|
|
26
|
-
await expect(checkedDisabledRadio).isChecked();
|
|
27
|
-
await expect(checkedDisabledRadio).toHaveAttribute('disabled', '');
|
|
28
|
-
});
|
|
29
|
-
test('interaction', async ({ page }) => {
|
|
30
|
-
await page.getByLabel('Radio button with label').click();
|
|
31
|
-
const radioWithLabel = page.locator('#with-label');
|
|
32
|
-
await expect(radioWithLabel).isChecked();
|
|
33
|
-
const uncheckedRadio = page.locator('#unchecked');
|
|
34
|
-
await uncheckedRadio.click();
|
|
35
|
-
await expect(uncheckedRadio).isChecked();
|
|
36
|
-
const disabledRadio = page.locator('#disabled');
|
|
37
|
-
await disabledRadio.click();
|
|
38
|
-
await expect(disabledRadio).isNotChecked();
|
|
39
|
-
const checkedDisabledRadio = page.locator('#checked-disabled');
|
|
40
|
-
await checkedDisabledRadio.click();
|
|
41
|
-
await expect(checkedDisabledRadio).isChecked();
|
|
42
|
-
});
|
|
43
|
-
test('form-submission', async ({ page }) => {
|
|
44
|
-
const getFormData = await onFormSubmitCallback(page, 'radio-form');
|
|
45
|
-
const radioGroupMember = page.locator('#group-member-1');
|
|
46
|
-
await radioGroupMember.click();
|
|
47
|
-
const radioGroupMember2 = page.locator('#group-member-2');
|
|
48
|
-
await radioGroupMember2.click();
|
|
49
|
-
const radioGroupMember3 = page.locator('#group-member-3');
|
|
50
|
-
await radioGroupMember3.click();
|
|
51
|
-
await page.locator('#submit-button').click();
|
|
52
|
-
await expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();
|
|
53
|
-
const formData = await getFormData();
|
|
54
|
-
expect(formData).toMatchObject({
|
|
55
|
-
checked: 'on',
|
|
56
|
-
'custom-value': 'custom-value',
|
|
57
|
-
'radio-group': 'option-3',
|
|
58
|
-
});
|
|
59
|
-
expect(formData).not.toHaveProperty('unchecked');
|
|
60
|
-
expect(formData).not.toHaveProperty('disabled');
|
|
61
|
-
expect(formData).not.toHaveProperty('checked-disabled');
|
|
62
|
-
});
|
|
63
|
-
test('form-reset', async ({ page }) => {
|
|
64
|
-
await page.locator('#unchecked').click();
|
|
65
|
-
await page.locator('#checked').click();
|
|
66
|
-
await page.locator('#reset-button').click();
|
|
67
|
-
await expect(page.locator('#unchecked')).isNotChecked();
|
|
68
|
-
await expect(page.locator('#checked')).isChecked();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=sds-radio.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio.spec.js","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IACrC,IAAI,CAAC,UAAU,CAAC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rC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;QACzC,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;QAEvC,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC;QAE5C,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;QACxD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { onFormSubmitCallback } from '../playwright-util/form';\nimport { expect } from '../playwright-util/custom-matchers';\n\ntest.describe('radio-component', () => {\n\ttest.beforeEach(async ({ page }) => {\n\t\tawait page.goto('iframe.html?viewMode=docs&id=test-radio--docs');\n\t});\n\n\ttest('visibility', async ({ page }) => {\n\t\tawait expect(page.locator('#with-label')).toBeVisible();\n\t\tawait expect(page.locator('#unchecked')).toBeVisible();\n\t\tawait expect(page.locator('#checked')).toBeVisible();\n\t\tawait expect(page.locator('#custom-value')).toBeVisible();\n\t\tawait expect(page.locator('#disabled')).toBeVisible();\n\t\tawait expect(page.locator('#checked-disabled')).toBeVisible();\n\t});\n\n\ttest('states', async ({ page }) => {\n\t\tconst radioWithLabel = page.locator('#with-label');\n\t\tawait expect(radioWithLabel).isNotChecked();\n\n\t\tconst uncheckedRadio = page.locator('#unchecked');\n\t\tawait expect(uncheckedRadio).isNotChecked();\n\n\t\tconst checkedRadio = page.locator('#checked');\n\t\tawait expect(checkedRadio).isChecked();\n\n\t\tconst disabledRadio = page.locator('#disabled');\n\t\tawait expect(disabledRadio).toHaveAttribute('disabled', '');\n\n\t\tconst checkedDisabledRadio = page.locator('#checked-disabled');\n\t\tawait expect(checkedDisabledRadio).isChecked();\n\t\tawait expect(checkedDisabledRadio).toHaveAttribute('disabled', '');\n\t});\n\n\ttest('interaction', async ({ page }) => {\n\t\tawait page.getByLabel('Radio button with label').click();\n\t\tconst radioWithLabel = page.locator('#with-label');\n\t\tawait expect(radioWithLabel).isChecked();\n\n\t\tconst uncheckedRadio = page.locator('#unchecked');\n\t\tawait uncheckedRadio.click();\n\t\tawait expect(uncheckedRadio).isChecked();\n\n\t\tconst disabledRadio = page.locator('#disabled');\n\t\tawait disabledRadio.click();\n\t\tawait expect(disabledRadio).isNotChecked();\n\n\t\tconst checkedDisabledRadio = page.locator('#checked-disabled');\n\t\tawait checkedDisabledRadio.click();\n\t\tawait expect(checkedDisabledRadio).isChecked();\n\t});\n\n\ttest('form-submission', async ({ page }) => {\n\t\tconst getFormData = await onFormSubmitCallback(page, 'radio-form');\n\n\t\tconst radioGroupMember = page.locator('#group-member-1');\n\t\tawait radioGroupMember.click();\n\n\t\tconst radioGroupMember2 = page.locator('#group-member-2');\n\t\tawait radioGroupMember2.click();\n\n\t\tconst radioGroupMember3 = page.locator('#group-member-3');\n\t\tawait radioGroupMember3.click();\n\n\t\tawait page.locator('#submit-button').click();\n\n\t\tawait expect.poll(async () => (await getFormData()) !== null, 'Form data not received').toBeTruthy();\n\t\tconst formData = await getFormData();\n\n\t\texpect(formData).toMatchObject({\n\t\t\tchecked: 'on',\n\t\t\t'custom-value': 'custom-value',\n\t\t\t'radio-group': 'option-3',\n\t\t});\n\t\texpect(formData).not.toHaveProperty('unchecked');\n\t\texpect(formData).not.toHaveProperty('disabled');\n\t\texpect(formData).not.toHaveProperty('checked-disabled');\n\t});\n\n\ttest('form-reset', async ({ page }) => {\n\t\tawait page.locator('#unchecked').click();\n\t\tawait page.locator('#checked').click();\n\n\t\tawait page.locator('#reset-button').click();\n\n\t\tawait expect(page.locator('#unchecked')).isNotChecked();\n\t\tawait expect(page.locator('#checked')).isChecked();\n\t});\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sds-textfield.spec.d.ts","sourceRoot":"","sources":["../../src/sds-textfield/sds-textfield.spec.ts"],"names":[],"mappings":""}
|