@sit-onyx/headless 0.12.0 → 0.12.1-dev-20261123100908
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/index.js +49 -80
- package/dist/playwright.js +7 -14
- package/package.json +7 -7
- package/dist/utils/vitest.d.ts +0 -13
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, shallowRef, toRef, toValue, unref, useId, watch, watchEffect } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/utils/builder.ts
|
|
3
3
|
/**
|
|
4
4
|
* We use this identity function to ensure the correct typings of the headless composables
|
|
5
5
|
*
|
|
@@ -69,8 +69,7 @@ var getNativeElement = (element) => {
|
|
|
69
69
|
if (element && typeof element === "object" && "$el" in element) return element.$el;
|
|
70
70
|
return element ?? null;
|
|
71
71
|
};
|
|
72
|
-
|
|
73
|
-
//#region src/utils/dates.ts
|
|
72
|
+
// src/utils/dates.ts
|
|
74
73
|
function getISOWeekNumber(date) {
|
|
75
74
|
const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
|
76
75
|
const dayNum = d.getUTCDay() || 7;
|
|
@@ -115,8 +114,7 @@ function sortDateRange(range) {
|
|
|
115
114
|
end
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
|
-
|
|
119
|
-
//#region src/composables/calendar/createCalendar.ts
|
|
117
|
+
// src/composables/calendar/createCalendar.ts
|
|
120
118
|
var createCalendar = createBuilder((options) => {
|
|
121
119
|
const viewMonth = computed({
|
|
122
120
|
get: () => {
|
|
@@ -135,23 +133,20 @@ var createCalendar = createBuilder((options) => {
|
|
|
135
133
|
const index = WEEKDAYS.indexOf(weekStartDay);
|
|
136
134
|
return names.slice(index).concat(names.slice(0, index));
|
|
137
135
|
});
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (!
|
|
136
|
+
const focusedDate = ref(/* @__PURE__ */ new Date());
|
|
137
|
+
/**
|
|
138
|
+
* Sync focusDate with viewMonth: Use the first of the following dates, where the date is in the
|
|
139
|
+
* current viewMonth: - focused date - selected date - first day in month
|
|
140
|
+
*/
|
|
141
|
+
watch(viewMonth, (newViewMonth) => {
|
|
142
|
+
if (focusedDate.value.getFullYear() === newViewMonth.getFullYear() && focusedDate.value.getMonth() === newViewMonth.getMonth()) return;
|
|
143
|
+
const value = toValue(options.modelValue);
|
|
144
|
+
if (!value) return;
|
|
147
145
|
let newFocusDate;
|
|
148
|
-
if (Array.isArray(
|
|
149
|
-
else if (typeof
|
|
150
|
-
else newFocusDate = new Date(
|
|
151
|
-
|
|
152
|
-
focusedDate.value = newFocusDate;
|
|
153
|
-
viewMonth.value = newFocusDate;
|
|
154
|
-
}
|
|
146
|
+
if (Array.isArray(value)) newFocusDate = value.length ? new Date(value[0]) : void 0;
|
|
147
|
+
else if (typeof value === "object" && !(value instanceof Date)) newFocusDate = new Date(value.start);
|
|
148
|
+
else newFocusDate = new Date(value);
|
|
149
|
+
focusedDate.value = newFocusDate || new Date(newViewMonth.getFullYear(), newViewMonth.getMonth(), 1);
|
|
155
150
|
}, { immediate: true });
|
|
156
151
|
const isToday = (date) => {
|
|
157
152
|
return date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
@@ -169,11 +164,7 @@ var createCalendar = createBuilder((options) => {
|
|
|
169
164
|
return new Date(value).toDateString() === date.toDateString();
|
|
170
165
|
};
|
|
171
166
|
});
|
|
172
|
-
const isFocused = computed(() =>
|
|
173
|
-
return (date) => {
|
|
174
|
-
return focusedDate.value?.toDateString() === date.toDateString();
|
|
175
|
-
};
|
|
176
|
-
});
|
|
167
|
+
const isFocused = computed(() => (date) => focusedDate.value?.toDateString() === date.toDateString());
|
|
177
168
|
const isDisabled = computed(() => {
|
|
178
169
|
return (date) => {
|
|
179
170
|
const disabledPropValue = toValue(options.disabled);
|
|
@@ -357,16 +348,14 @@ var createCalendar = createBuilder((options) => {
|
|
|
357
348
|
}
|
|
358
349
|
};
|
|
359
350
|
});
|
|
360
|
-
|
|
361
|
-
//#region src/utils/object.ts
|
|
351
|
+
// src/utils/object.ts
|
|
362
352
|
/**
|
|
363
353
|
* Check if every entry of a subset exists and matches the entry of a target object.
|
|
364
354
|
*
|
|
365
355
|
* @returns `true`, if target contains the subset
|
|
366
356
|
*/
|
|
367
357
|
var isSubsetMatching = (subset, target) => Object.entries(subset).every(([key, value]) => target[key] === value);
|
|
368
|
-
|
|
369
|
-
//#region src/utils/keyboard.ts
|
|
358
|
+
// src/utils/keyboard.ts
|
|
370
359
|
/**
|
|
371
360
|
* Check if a specified key was pressed.
|
|
372
361
|
*
|
|
@@ -397,8 +386,7 @@ var GRAPHEME_SEGMENTER = new Intl.Segmenter("en-US");
|
|
|
397
386
|
* without need to keep a list of all named key.
|
|
398
387
|
*/
|
|
399
388
|
var isPrintableCharacter = (key) => [...GRAPHEME_SEGMENTER.segment(key)].length === 1;
|
|
400
|
-
|
|
401
|
-
//#region src/composables/helpers/useGlobalListener.ts
|
|
389
|
+
// src/composables/helpers/useGlobalListener.ts
|
|
402
390
|
var GLOBAL_LISTENERS = reactive(/* @__PURE__ */ new Map());
|
|
403
391
|
var updateRemainingListeners = (type, remaining) => {
|
|
404
392
|
if (remaining?.size) {
|
|
@@ -431,8 +419,7 @@ var useGlobalEventListener = ({ type, listener, disabled }) => {
|
|
|
431
419
|
onBeforeMount(() => watchEffect(() => disabled?.value ? removeGlobalListener(type, listener) : addGlobalListener(type, listener)));
|
|
432
420
|
onBeforeUnmount(() => removeGlobalListener(type, listener));
|
|
433
421
|
};
|
|
434
|
-
|
|
435
|
-
//#region src/composables/helpers/useOutsideClick.ts
|
|
422
|
+
// src/composables/helpers/useOutsideClick.ts
|
|
436
423
|
/**
|
|
437
424
|
* Composable for listening to click events that occur outside of a component.
|
|
438
425
|
* Useful to e.g. close flyouts or tooltips.
|
|
@@ -509,8 +496,7 @@ var useOutsideClick = ({ inside, onOutsideClick, disabled, checkOnTab }) => {
|
|
|
509
496
|
});
|
|
510
497
|
}
|
|
511
498
|
};
|
|
512
|
-
|
|
513
|
-
//#region src/utils/timer.ts
|
|
499
|
+
// src/utils/timer.ts
|
|
514
500
|
/**
|
|
515
501
|
* Debounces a given callback which will only be called when not called for the given timeout.
|
|
516
502
|
*
|
|
@@ -528,8 +514,7 @@ var debounce = (handler, timeout) => {
|
|
|
528
514
|
func.abort = () => clearTimeout(timer);
|
|
529
515
|
return func;
|
|
530
516
|
};
|
|
531
|
-
|
|
532
|
-
//#region src/composables/helpers/useTypeAhead.ts
|
|
517
|
+
// src/composables/helpers/useTypeAhead.ts
|
|
533
518
|
/**
|
|
534
519
|
* Enhances typeAhead to combine multiple inputs in quick succession and filter out non-printable
|
|
535
520
|
* characters.
|
|
@@ -551,8 +536,7 @@ var useTypeAhead = (callback, timeout = 500) => {
|
|
|
551
536
|
callback(inputString);
|
|
552
537
|
};
|
|
553
538
|
};
|
|
554
|
-
|
|
555
|
-
//#region src/composables/listbox/createListbox.ts
|
|
539
|
+
// src/composables/listbox/createListbox.ts
|
|
556
540
|
/**
|
|
557
541
|
* Composable for creating a accessibility-conform listbox. For supported keyboard shortcuts, see:
|
|
558
542
|
* https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-scrollable/
|
|
@@ -669,8 +653,7 @@ var createListbox = createBuilder((options) => {
|
|
|
669
653
|
}
|
|
670
654
|
};
|
|
671
655
|
});
|
|
672
|
-
|
|
673
|
-
//#region src/composables/comboBox/createComboBox.ts
|
|
656
|
+
// src/composables/comboBox/createComboBox.ts
|
|
674
657
|
var OPENING_KEYS = [
|
|
675
658
|
"ArrowDown",
|
|
676
659
|
"ArrowUp",
|
|
@@ -817,8 +800,7 @@ var createComboBox = createBuilder(({ autocomplete: autocompleteRef, onAutocompl
|
|
|
817
800
|
}
|
|
818
801
|
};
|
|
819
802
|
});
|
|
820
|
-
|
|
821
|
-
//#region src/composables/helpers/useAllSettled.ts
|
|
803
|
+
// src/composables/helpers/useAllSettled.ts
|
|
822
804
|
/**
|
|
823
805
|
* Execute a callback, when all added promise are settled (either resolved or rejected).
|
|
824
806
|
* It allows for more promises to be added while waiting.
|
|
@@ -848,8 +830,7 @@ var useAllSettled = (cb) => {
|
|
|
848
830
|
active
|
|
849
831
|
};
|
|
850
832
|
};
|
|
851
|
-
|
|
852
|
-
//#region src/composables/helpers/useLastSettled.ts
|
|
833
|
+
// src/composables/helpers/useLastSettled.ts
|
|
853
834
|
/**
|
|
854
835
|
* Execute a callback, when the latest promise is settled (either resolved or rejected). This
|
|
855
836
|
* ensures that out-of-order settling promises are ignored and only the latest promise is
|
|
@@ -884,8 +865,7 @@ var useLastSettled = (cb) => {
|
|
|
884
865
|
cancel
|
|
885
866
|
};
|
|
886
867
|
};
|
|
887
|
-
|
|
888
|
-
//#region src/composables/dataGrid/createDataGrid.ts
|
|
868
|
+
// src/composables/dataGrid/createDataGrid.ts
|
|
889
869
|
var COL_KEY_DATA_ATTR = "data-onyx-col-key";
|
|
890
870
|
var COL_INDEX_ARIA_ATTR = "aria-colindex";
|
|
891
871
|
var ROW_ID_DATA_ATTR = "data-onyx-row-id";
|
|
@@ -1057,8 +1037,7 @@ busy },
|
|
|
1057
1037
|
internals: {}
|
|
1058
1038
|
};
|
|
1059
1039
|
});
|
|
1060
|
-
|
|
1061
|
-
//#region src/composables/menuButton/createMenuButton.ts
|
|
1040
|
+
// src/composables/menuButton/createMenuButton.ts
|
|
1062
1041
|
/**
|
|
1063
1042
|
* Based on https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/
|
|
1064
1043
|
*/
|
|
@@ -1297,8 +1276,7 @@ var createMenuItems = createBuilder((options) => {
|
|
|
1297
1276
|
}
|
|
1298
1277
|
};
|
|
1299
1278
|
});
|
|
1300
|
-
|
|
1301
|
-
//#region src/utils/math.ts
|
|
1279
|
+
// src/utils/math.ts
|
|
1302
1280
|
var MathUtils = {
|
|
1303
1281
|
/**
|
|
1304
1282
|
* Ensures that a given `number` is or is between a given `min` and `max`.
|
|
@@ -1332,8 +1310,7 @@ var MathUtils = {
|
|
|
1332
1310
|
*/
|
|
1333
1311
|
percentToValue: (percent, min, max) => (max - min) * percent + min
|
|
1334
1312
|
};
|
|
1335
|
-
|
|
1336
|
-
//#region src/composables/navigationMenu/createMenu.ts
|
|
1313
|
+
// src/composables/navigationMenu/createMenu.ts
|
|
1337
1314
|
/**
|
|
1338
1315
|
* Based on https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/
|
|
1339
1316
|
*/
|
|
@@ -1363,11 +1340,9 @@ var createNavigationMenu = createBuilder(({ navigationName }) => {
|
|
|
1363
1340
|
}
|
|
1364
1341
|
} } };
|
|
1365
1342
|
});
|
|
1366
|
-
|
|
1367
|
-
//#region src/utils/array.ts
|
|
1343
|
+
// src/utils/array.ts
|
|
1368
1344
|
var areArraysEqual = (arrayA, arrayB, comparer = (a, b) => a === b) => arrayA.length === arrayB.length && arrayA.every((value, index) => comparer(value, arrayB[index]));
|
|
1369
|
-
|
|
1370
|
-
//#region src/composables/slider/createSlider.ts
|
|
1345
|
+
// src/composables/slider/createSlider.ts
|
|
1371
1346
|
var NAVIGATION_KEYS = /* @__PURE__ */ new Set([
|
|
1372
1347
|
"ArrowUp",
|
|
1373
1348
|
"ArrowDown",
|
|
@@ -1418,6 +1393,7 @@ var createSlider = createBuilder((options) => {
|
|
|
1418
1393
|
});
|
|
1419
1394
|
/**
|
|
1420
1395
|
* Normalizes the given slider (values) by ensuring that:
|
|
1396
|
+
*
|
|
1421
1397
|
* 1. Value is between min and max range
|
|
1422
1398
|
* 2. Values are matching the `step` property (are multiples of it)
|
|
1423
1399
|
* 3. Are sorted ascending (if range mode)
|
|
@@ -1590,8 +1566,7 @@ var createSlider = createBuilder((options) => {
|
|
|
1590
1566
|
}
|
|
1591
1567
|
};
|
|
1592
1568
|
});
|
|
1593
|
-
|
|
1594
|
-
//#region src/composables/tabs/createTabs.ts
|
|
1569
|
+
// src/composables/tabs/createTabs.ts
|
|
1595
1570
|
/**
|
|
1596
1571
|
* Composable for implementing accessible tabs.
|
|
1597
1572
|
* Based on https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
@@ -1682,8 +1657,7 @@ var createTabs = createBuilder((options) => {
|
|
|
1682
1657
|
})
|
|
1683
1658
|
} };
|
|
1684
1659
|
});
|
|
1685
|
-
|
|
1686
|
-
//#region src/composables/toggleButton/createToggleButton.ts
|
|
1660
|
+
// src/composables/toggleButton/createToggleButton.ts
|
|
1687
1661
|
/**
|
|
1688
1662
|
* Based on https://www.w3.org/WAI/ARIA/apg/patterns/button/#:~:text=Toggle%20button
|
|
1689
1663
|
*/
|
|
@@ -1697,8 +1671,7 @@ button: computed(() => ({
|
|
|
1697
1671
|
onClick: options.onToggle
|
|
1698
1672
|
})) } };
|
|
1699
1673
|
});
|
|
1700
|
-
|
|
1701
|
-
//#region src/composables/helpers/useDismissible.ts
|
|
1674
|
+
// src/composables/helpers/useDismissible.ts
|
|
1702
1675
|
/**
|
|
1703
1676
|
* Composable that sets `isExpanded` to false, when the `Escape` key is pressed. Addresses the
|
|
1704
1677
|
* "dismissible" aspect of
|
|
@@ -1711,8 +1684,7 @@ var useDismissible = ({ isExpanded }) => useGlobalEventListener({
|
|
|
1711
1684
|
},
|
|
1712
1685
|
disabled: computed(() => !isExpanded.value)
|
|
1713
1686
|
});
|
|
1714
|
-
|
|
1715
|
-
//#region src/composables/tooltip/createToggletip.ts
|
|
1687
|
+
// src/composables/tooltip/createToggletip.ts
|
|
1716
1688
|
/**
|
|
1717
1689
|
* Create a toggletip as described in https://inclusive-components.design/tooltips-toggletips/
|
|
1718
1690
|
* Its visibility is toggled on click.
|
|
@@ -1754,8 +1726,7 @@ var createToggletip = createBuilder(({ toggleLabel, isVisible }) => {
|
|
|
1754
1726
|
state: { isVisible: _isVisible }
|
|
1755
1727
|
};
|
|
1756
1728
|
});
|
|
1757
|
-
|
|
1758
|
-
//#region src/composables/tooltip/createTooltip.ts
|
|
1729
|
+
// src/composables/tooltip/createTooltip.ts
|
|
1759
1730
|
/**
|
|
1760
1731
|
* Create a tooltip as described in
|
|
1761
1732
|
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role Its visibility
|
|
@@ -1810,16 +1781,14 @@ var createTooltip = createBuilder(({ debounce, isVisible }) => {
|
|
|
1810
1781
|
state: { isVisible: _isVisible }
|
|
1811
1782
|
};
|
|
1812
1783
|
});
|
|
1813
|
-
|
|
1814
|
-
//#region src/composables/treeView/createTreeView.ts
|
|
1784
|
+
// src/composables/treeView/createTreeView.ts
|
|
1815
1785
|
var createTreeView = createBuilder((options) => {
|
|
1816
1786
|
return { elements: { tree: computed(() => ({
|
|
1817
1787
|
role: "tree",
|
|
1818
1788
|
"aria-label": toValue(options.label)
|
|
1819
1789
|
})) } };
|
|
1820
1790
|
});
|
|
1821
|
-
|
|
1822
|
-
//#region src/composables/treeView/createTreeViewItem.ts
|
|
1791
|
+
// src/composables/treeView/createTreeViewItem.ts
|
|
1823
1792
|
var createTreeViewItem = createBuilder((options) => {
|
|
1824
1793
|
const disabled = computed(() => toValue(options.disabled));
|
|
1825
1794
|
const level = computed(() => toValue(options.level));
|
|
@@ -1859,11 +1828,13 @@ var createTreeViewItem = createBuilder((options) => {
|
|
|
1859
1828
|
break;
|
|
1860
1829
|
case "ArrowRight":
|
|
1861
1830
|
event.preventDefault();
|
|
1862
|
-
if (hasChildren.value)
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1831
|
+
if (hasChildren.value) {
|
|
1832
|
+
if (isOpen.value) {
|
|
1833
|
+
const items = getVisibleTreeItems(currentTrigger);
|
|
1834
|
+
const currentIndex = items.indexOf(currentTrigger);
|
|
1835
|
+
if (currentIndex !== -1 && currentIndex < items.length - 1) items[currentIndex + 1].focus();
|
|
1836
|
+
} else options.onToggle?.(true);
|
|
1837
|
+
}
|
|
1867
1838
|
break;
|
|
1868
1839
|
case "ArrowLeft":
|
|
1869
1840
|
event.preventDefault();
|
|
@@ -1914,8 +1885,7 @@ var createTreeViewItem = createBuilder((options) => {
|
|
|
1914
1885
|
onKeydown: handleKeyDown
|
|
1915
1886
|
})) } };
|
|
1916
1887
|
});
|
|
1917
|
-
|
|
1918
|
-
//#region src/composables/dragAndDrop/createDragAndDrop.ts
|
|
1888
|
+
// src/composables/dragAndDrop/createDragAndDrop.ts
|
|
1919
1889
|
/**
|
|
1920
1890
|
* Composable for creating drag and drop functionality.
|
|
1921
1891
|
*/
|
|
@@ -1956,5 +1926,4 @@ var createDragAndDrop = createBuilder((options) => {
|
|
|
1956
1926
|
})
|
|
1957
1927
|
} };
|
|
1958
1928
|
});
|
|
1959
|
-
//#endregion
|
|
1960
1929
|
export { CLOSING_KEYS, OPENING_KEYS, createBuilder, createCalendar, createComboBox, createDataGrid, createDragAndDrop, createElRef, createListbox, createMenuButton, createMenuItems, createNavigationMenu, createSlider, createTabs, createToggleButton, createToggletip, createTooltip, createTreeView, createTreeViewItem, debounce, getNativeElement, isPrintableCharacter, useGlobalEventListener, useOutsideClick, wasKeyPressed };
|
package/dist/playwright.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expect, test } from "@playwright/experimental-ct-vue";
|
|
2
|
-
|
|
2
|
+
// src/composables/comboBox/createComboBox.testing.ts
|
|
3
3
|
var expectToOpen = async (keyCombo, combobox, listbox, checkActive) => {
|
|
4
4
|
await closeCombobox(combobox, listbox);
|
|
5
5
|
await combobox.press(keyCombo);
|
|
@@ -90,8 +90,7 @@ var comboboxSelectOnlyTesting = async (page, listbox, combobox, isActive) => {
|
|
|
90
90
|
await expect(combobox).toBeFocused();
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
//#region src/composables/listbox/createListbox.testing.ts
|
|
93
|
+
// src/composables/listbox/createListbox.testing.ts
|
|
95
94
|
/**
|
|
96
95
|
* Playwright utility for executing accessibility testing for a listbox. Will check aria attributes
|
|
97
96
|
* and keyboard shortcuts as defined in
|
|
@@ -145,8 +144,7 @@ var listboxTesting = async ({ page, listbox, options, isOptionActive }) => {
|
|
|
145
144
|
element.style.overflow = "";
|
|
146
145
|
});
|
|
147
146
|
};
|
|
148
|
-
|
|
149
|
-
//#region src/composables/menuButton/createMenuButton.testing.ts
|
|
147
|
+
// src/composables/menuButton/createMenuButton.testing.ts
|
|
150
148
|
/**
|
|
151
149
|
* Playwright utility for executing accessibility testing for a navigation menu. Will check aria
|
|
152
150
|
* attributes and keyboard shortcuts as defined in
|
|
@@ -181,8 +179,7 @@ var menuButtonTesting = async ({ page, button, menu, menuItems }) => {
|
|
|
181
179
|
await menu.press("End");
|
|
182
180
|
await expect(lastItem, "Last item should be focused when pressing end key").toBeFocused();
|
|
183
181
|
};
|
|
184
|
-
|
|
185
|
-
//#region src/composables/navigationMenu/createMenu.testing.ts
|
|
182
|
+
// src/composables/navigationMenu/createMenu.testing.ts
|
|
186
183
|
/**
|
|
187
184
|
* Playwright utility for executing accessibility testing for a navigation menu. Will check aria
|
|
188
185
|
* attributes and keyboard shortcuts as defined in
|
|
@@ -207,8 +204,7 @@ var navigationTesting = async ({ nav, buttons }) => {
|
|
|
207
204
|
await nav.press("ArrowLeft");
|
|
208
205
|
await expect(buttons.nth(0)).toBeFocused();
|
|
209
206
|
};
|
|
210
|
-
|
|
211
|
-
//#region src/composables/slider/createSlider.testing.ts
|
|
207
|
+
// src/composables/slider/createSlider.testing.ts
|
|
212
208
|
var getRailPosition = async (rail, percentage) => {
|
|
213
209
|
const box = await rail.boundingBox();
|
|
214
210
|
return {
|
|
@@ -358,8 +354,7 @@ var rangeSliderTesting = async ({ page, slider, rail }) => {
|
|
|
358
354
|
await expect(lastThumb).toHaveValue("100");
|
|
359
355
|
});
|
|
360
356
|
};
|
|
361
|
-
|
|
362
|
-
//#region src/composables/tabs/createTabs.testing.ts
|
|
357
|
+
// src/composables/tabs/createTabs.testing.ts
|
|
363
358
|
/**
|
|
364
359
|
* Playwright utility for executing accessibility testing for tabs. Will check aria attributes and
|
|
365
360
|
* keyboard shortcuts as defined in https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
|
|
@@ -444,8 +439,7 @@ var expectPanelAttributes = async (panel, tabId) => {
|
|
|
444
439
|
await expect(panel, "panel must have an ID").toHaveAttribute("id");
|
|
445
440
|
await expect(panel, "panel must have \"aria-labelledby\" set").toHaveAttribute("aria-labelledby", tabId);
|
|
446
441
|
};
|
|
447
|
-
|
|
448
|
-
//#region src/composables/toggleButton/createToggleButton.testing.ts
|
|
442
|
+
// src/composables/toggleButton/createToggleButton.testing.ts
|
|
449
443
|
/**
|
|
450
444
|
* Playwright utility for executing accessibility testing for a navigation menu. Will check aria
|
|
451
445
|
* attributes and keyboard shortcuts as defined in
|
|
@@ -462,5 +456,4 @@ var toggleButtonTesting = async ({ button, labelText, initiallyPressed }) => {
|
|
|
462
456
|
await expect(button, `button must toggle 'aria-pressed' attribute after click.`).toHaveAttribute("aria-pressed", String(initiallyPressed));
|
|
463
457
|
await expect(button, "button must not switch it's label after a state change").toHaveAccessibleName(labelText);
|
|
464
458
|
};
|
|
465
|
-
//#endregion
|
|
466
459
|
export { comboboxSelectOnlyTesting, comboboxTesting, listboxTesting, menuButtonTesting, navigationTesting, rangeSliderTesting, singleSliderTesting, tabsTesting, toggleButtonTesting };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/headless",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1-dev-20261123100908",
|
|
4
4
|
"description": "Headless composables for Vue",
|
|
5
5
|
"homepage": "https://onyx.schwarz/development/packages/headless.html",
|
|
6
6
|
"bugs": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
32
|
+
"@sit-onyx/shared": "^0.1.0",
|
|
33
|
+
"@vue/compiler-dom": "3.5.44",
|
|
34
|
+
"unplugin-dts": "1.1.2",
|
|
35
|
+
"vite": "8.3.8",
|
|
36
|
+
"vue": "3.5.44"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@playwright/experimental-ct-vue": "1.62.1",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vue": ">= 3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=
|
|
45
|
+
"node": ">=22"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "vite build",
|
package/dist/utils/vitest.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mocks the following vue lifecycle functions:
|
|
3
|
-
* - onBeforeMount
|
|
4
|
-
* - onMounted
|
|
5
|
-
* - onBeforeUnmount
|
|
6
|
-
* - onUnmounted
|
|
7
|
-
*
|
|
8
|
-
* `onBeforeMount` and `onMounted` callbacks are executed immediately.
|
|
9
|
-
* `onBeforeUnmount` and `onUnmounted` are executed when the returned callback is run.
|
|
10
|
-
*
|
|
11
|
-
* @returns A callback to trigger the run of `onBeforeUnmount` and `onUnmounted`
|
|
12
|
-
*/
|
|
13
|
-
export declare const mockVueLifecycle: () => () => Promise<void>;
|