aria-ease 6.10.0 → 6.12.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/README.md +2 -2
- package/{bin/buildContracts-S22V7AGV.js → dist/buildContracts-FT6KWUJN.js} +3 -3
- package/dist/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +0 -21
- package/{bin/chunk-NI3MQCAS.js → dist/chunk-GJGUY643.js} +2 -2
- package/{bin → dist}/cli.cjs +30 -67
- package/{bin → dist}/cli.js +4 -4
- package/dist/{configLoader-DWHOHXHL.js → configLoader-Q7N5XV4P.js} +2 -2
- package/{bin/configLoader-UJZHQBYS.js → dist/configLoader-REHK3S3Q.js} +1 -1
- package/{bin/contractTestRunnerPlaywright-QDXSK3FE.js → dist/contractTestRunnerPlaywright-DIXP5DQ3.js} +5 -20
- package/dist/{contractTestRunnerPlaywright-WNWQYSXZ.js → contractTestRunnerPlaywright-EWAWQVHT.js} +5 -20
- package/dist/index.cjs +164 -122
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +155 -71
- package/dist/src/{Types.d-yGC2bBaB.d.ts → Types.d-DYfYR3Vc.d.cts} +1 -1
- package/dist/src/{Types.d-yGC2bBaB.d.cts → Types.d-DYfYR3Vc.d.ts} +1 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/tabs/index.d.cts +1 -1
- package/dist/src/tabs/index.d.ts +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/utils/test/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +1 -21
- package/dist/src/utils/test/{configLoader-SHJSRG2A.js → configLoader-NA7IBCS3.js} +2 -2
- package/dist/src/utils/test/{contractTestRunnerPlaywright-Z2AHXSNM.js → contractTestRunnerPlaywright-CIZOXYRW.js} +5 -19
- package/dist/src/utils/test/dsl/index.cjs +139 -60
- package/dist/src/utils/test/dsl/index.d.cts +3 -0
- package/dist/src/utils/test/dsl/index.d.ts +3 -0
- package/dist/src/utils/test/dsl/index.js +139 -60
- package/dist/src/utils/test/index.cjs +19 -55
- package/dist/src/utils/test/index.js +16 -10
- package/{bin/test-O3J4ZPQR.js → dist/test-HBPCSYH5.js} +16 -11
- package/package.json +5 -7
- package/bin/AccordionComponentStrategy-4ZEIQ2V6.js +0 -42
- package/bin/ComboboxComponentStrategy-OGRVZXAF.js +0 -64
- package/bin/MenuComponentStrategy-JAMTCSNF.js +0 -81
- package/bin/TabsComponentStrategy-3SQURPMX.js +0 -29
- package/bin/chunk-I2KLQ2HA.js +0 -22
- package/bin/chunk-PK5L2SAF.js +0 -17
- package/bin/chunk-XERMSYEH.js +0 -363
- package/dist/src/utils/test/aria-contracts/accordion/accordion.contract.json +0 -290
- package/dist/src/utils/test/aria-contracts/combobox/combobox.listbox.contract.json +0 -463
- package/dist/src/utils/test/aria-contracts/menu/menu.contract.json +0 -562
- package/dist/src/utils/test/aria-contracts/tabs/tabs.contract.json +0 -361
- /package/{bin → dist}/audit-RM6TCZ5C.js +0 -0
- /package/{bin → dist}/badgeHelper-JOWO6RQG.js +0 -0
- /package/{bin → dist}/chunk-JJEPLK7L.js +0 -0
- /package/{bin → dist}/cli.d.cts +0 -0
- /package/{bin → dist}/cli.d.ts +0 -0
- /package/{bin → dist}/formatters-32KQIIYS.js +0 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContractReporter,
|
|
3
3
|
closeSharedBrowser,
|
|
4
|
-
contract_default,
|
|
5
4
|
normalizeLevel,
|
|
6
5
|
normalizeStrictness,
|
|
7
6
|
resolveEnforcement
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FZ7GMIJB.js";
|
|
9
8
|
import "./chunk-I2KLQ2HA.js";
|
|
10
9
|
|
|
11
10
|
// src/accordion/src/makeAccordionAccessible/makeAccordionAccessible.ts
|
|
@@ -1509,90 +1508,141 @@ function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation
|
|
|
1509
1508
|
}
|
|
1510
1509
|
|
|
1511
1510
|
// src/utils/test/dsl/src/state-packs/comboboxStatePack.ts
|
|
1511
|
+
function hasCapabilities(ctx, requiredCaps) {
|
|
1512
|
+
return requiredCaps.some((cap) => ctx.capabilities.includes(cap));
|
|
1513
|
+
}
|
|
1514
|
+
function resolveSetup(setup, ctx) {
|
|
1515
|
+
if (Array.isArray(setup) && setup.length && !setup[0].when) {
|
|
1516
|
+
setup = [{ when: ["keyboard"], steps: () => setup }];
|
|
1517
|
+
}
|
|
1518
|
+
for (const strat of setup) {
|
|
1519
|
+
if (hasCapabilities(ctx, strat.when)) {
|
|
1520
|
+
return strat.steps(ctx);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
throw new Error(
|
|
1524
|
+
`No setup strategy matches capabilities: ${ctx.capabilities.join(", ")}`
|
|
1525
|
+
);
|
|
1526
|
+
}
|
|
1512
1527
|
var COMBOBOX_STATES = {
|
|
1513
1528
|
"listbox.open": {
|
|
1514
|
-
setup:
|
|
1515
|
-
|
|
1529
|
+
setup: [
|
|
1530
|
+
{
|
|
1531
|
+
when: ["keyboard", "textInput"],
|
|
1532
|
+
steps: () => [
|
|
1533
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
1534
|
+
]
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
when: ["pointer"],
|
|
1538
|
+
steps: () => [
|
|
1539
|
+
{ type: "click", target: "button" }
|
|
1540
|
+
]
|
|
1541
|
+
}
|
|
1542
|
+
],
|
|
1543
|
+
assertion: isComboboxOpen
|
|
1516
1544
|
},
|
|
1517
1545
|
"listbox.closed": {
|
|
1518
|
-
setup:
|
|
1519
|
-
|
|
1546
|
+
setup: [
|
|
1547
|
+
{
|
|
1548
|
+
when: ["keyboard"],
|
|
1549
|
+
steps: () => [
|
|
1550
|
+
/* { type: "keypress", target: "input", key: "Escape" } */
|
|
1551
|
+
]
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
when: ["pointer"],
|
|
1555
|
+
steps: () => [
|
|
1556
|
+
/* { type: "click", target: "button" } */
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
],
|
|
1560
|
+
assertion: isComboboxClosed
|
|
1520
1561
|
},
|
|
1521
1562
|
"input.focused": {
|
|
1522
|
-
setup:
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1563
|
+
setup: [
|
|
1564
|
+
{
|
|
1565
|
+
when: ["keyboard"],
|
|
1566
|
+
steps: () => [
|
|
1567
|
+
{ type: "focus", target: "input" }
|
|
1568
|
+
]
|
|
1569
|
+
}
|
|
1570
|
+
],
|
|
1571
|
+
assertion: isInputFocused
|
|
1526
1572
|
},
|
|
1527
1573
|
"input.filled": {
|
|
1528
|
-
setup:
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1574
|
+
setup: [
|
|
1575
|
+
{
|
|
1576
|
+
when: ["keyboard", "textInput"],
|
|
1577
|
+
steps: () => [
|
|
1578
|
+
{ type: "type", target: "input", value: "test" }
|
|
1579
|
+
]
|
|
1580
|
+
}
|
|
1581
|
+
],
|
|
1582
|
+
assertion: isInputFilled
|
|
1532
1583
|
},
|
|
1533
1584
|
"activeOption.first": {
|
|
1534
1585
|
requires: ["listbox.open"],
|
|
1535
1586
|
setup: [
|
|
1536
|
-
{
|
|
1587
|
+
{
|
|
1588
|
+
when: ["keyboard"],
|
|
1589
|
+
steps: () => [
|
|
1590
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1537
1593
|
],
|
|
1538
|
-
assertion:
|
|
1539
|
-
...isActiveDescendantNotEmpty()
|
|
1540
|
-
]
|
|
1594
|
+
assertion: isActiveDescendantNotEmpty
|
|
1541
1595
|
},
|
|
1542
1596
|
"activeOption.last": {
|
|
1543
1597
|
requires: ["activeOption.first"],
|
|
1544
1598
|
setup: [
|
|
1545
|
-
{
|
|
1599
|
+
{
|
|
1600
|
+
when: ["keyboard"],
|
|
1601
|
+
steps: () => [
|
|
1602
|
+
{ type: "keypress", target: "input", key: "ArrowUp" }
|
|
1603
|
+
]
|
|
1604
|
+
}
|
|
1546
1605
|
],
|
|
1547
|
-
assertion:
|
|
1548
|
-
...isActiveDescendantNotEmpty()
|
|
1549
|
-
]
|
|
1606
|
+
assertion: isActiveDescendantNotEmpty
|
|
1550
1607
|
},
|
|
1551
1608
|
"selectedOption.first": {
|
|
1552
1609
|
requires: ["listbox.open"],
|
|
1553
1610
|
setup: [
|
|
1554
|
-
{
|
|
1611
|
+
{
|
|
1612
|
+
when: ["pointer"],
|
|
1613
|
+
steps: () => [
|
|
1614
|
+
{ type: "click", target: "relative", relativeTarget: "first" }
|
|
1615
|
+
]
|
|
1616
|
+
}
|
|
1555
1617
|
],
|
|
1556
|
-
assertion:
|
|
1557
|
-
...isAriaSelected("first")
|
|
1558
|
-
]
|
|
1618
|
+
assertion: () => isAriaSelected("first")
|
|
1559
1619
|
},
|
|
1560
1620
|
"selectedOption.last": {
|
|
1561
1621
|
requires: ["listbox.open"],
|
|
1562
1622
|
setup: [
|
|
1563
|
-
{
|
|
1623
|
+
{
|
|
1624
|
+
when: ["pointer"],
|
|
1625
|
+
steps: () => [
|
|
1626
|
+
{ type: "click", target: "relative", relativeTarget: "last" }
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1564
1629
|
],
|
|
1565
|
-
assertion:
|
|
1566
|
-
...isAriaSelected("first")
|
|
1567
|
-
]
|
|
1630
|
+
assertion: () => isAriaSelected("last")
|
|
1568
1631
|
}
|
|
1569
1632
|
};
|
|
1570
|
-
function openCombobox() {
|
|
1571
|
-
return [
|
|
1572
|
-
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
1573
|
-
];
|
|
1574
|
-
}
|
|
1575
|
-
function closeCombobox() {
|
|
1576
|
-
return [
|
|
1577
|
-
{ type: "keypress", target: "input", key: "Escape" }
|
|
1578
|
-
];
|
|
1579
|
-
}
|
|
1580
|
-
function focusInput() {
|
|
1581
|
-
return [
|
|
1582
|
-
{ type: "focus", target: "input" }
|
|
1583
|
-
];
|
|
1584
|
-
}
|
|
1585
|
-
function fillInput() {
|
|
1586
|
-
return [
|
|
1587
|
-
{ type: "type", target: "input", value: "test" }
|
|
1588
|
-
];
|
|
1589
|
-
}
|
|
1590
1633
|
function isComboboxOpen() {
|
|
1591
1634
|
return [
|
|
1592
1635
|
{
|
|
1593
1636
|
target: "listbox",
|
|
1594
1637
|
assertion: "toBeVisible",
|
|
1595
1638
|
failureMessage: "Expected listbox to be visible"
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
target: "input",
|
|
1642
|
+
assertion: "toHaveAttribute",
|
|
1643
|
+
attribute: "aria-expanded",
|
|
1644
|
+
expectedValue: "true",
|
|
1645
|
+
failureMessage: "Expect combobox input to have aria-expanded='true'"
|
|
1596
1646
|
}
|
|
1597
1647
|
];
|
|
1598
1648
|
}
|
|
@@ -1602,6 +1652,13 @@ function isComboboxClosed() {
|
|
|
1602
1652
|
target: "listbox",
|
|
1603
1653
|
assertion: "notToBeVisible",
|
|
1604
1654
|
failureMessage: "Expected listbox to be closed"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
target: "input",
|
|
1658
|
+
assertion: "toHaveAttribute",
|
|
1659
|
+
attribute: "aria-expanded",
|
|
1660
|
+
expectedValue: "false",
|
|
1661
|
+
failureMessage: "Expect combobox input to have aria-expanded='false'"
|
|
1605
1662
|
}
|
|
1606
1663
|
];
|
|
1607
1664
|
}
|
|
@@ -1624,7 +1681,7 @@ function isAriaSelected(index) {
|
|
|
1624
1681
|
assertion: "toHaveAttribute",
|
|
1625
1682
|
attribute: "aria-selected",
|
|
1626
1683
|
expectedValue: "true",
|
|
1627
|
-
failureMessage: `Expected
|
|
1684
|
+
failureMessage: `Expected ${index} option to have aria-selected='true'`
|
|
1628
1685
|
}
|
|
1629
1686
|
];
|
|
1630
1687
|
}
|
|
@@ -1650,7 +1707,7 @@ function isInputFilled() {
|
|
|
1650
1707
|
|
|
1651
1708
|
// src/utils/test/dsl/src/contractBuilder.ts
|
|
1652
1709
|
var STATE_PACKS = {
|
|
1653
|
-
"combobox
|
|
1710
|
+
"combobox": COMBOBOX_STATES
|
|
1654
1711
|
// Add more mappings as needed
|
|
1655
1712
|
};
|
|
1656
1713
|
var FluentContract = class {
|
|
@@ -1684,11 +1741,13 @@ var ContractBuilder = class {
|
|
|
1684
1741
|
const api = {
|
|
1685
1742
|
ariaReference: (from, attribute, to) => ({
|
|
1686
1743
|
required: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "required" }),
|
|
1687
|
-
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" })
|
|
1744
|
+
optional: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "optional" }),
|
|
1745
|
+
recommended: () => this.relationshipInvariants.push({ type: "aria-reference", from, attribute, to, level: "recommended" })
|
|
1688
1746
|
}),
|
|
1689
1747
|
contains: (parent, child) => ({
|
|
1690
1748
|
required: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "required" }),
|
|
1691
|
-
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" })
|
|
1749
|
+
optional: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "optional" }),
|
|
1750
|
+
recommended: () => this.relationshipInvariants.push({ type: "contains", parent, child, level: "recommended" })
|
|
1692
1751
|
})
|
|
1693
1752
|
};
|
|
1694
1753
|
fn(api);
|
|
@@ -1699,7 +1758,8 @@ var ContractBuilder = class {
|
|
|
1699
1758
|
target: (target) => ({
|
|
1700
1759
|
has: (attribute, expectedValue) => ({
|
|
1701
1760
|
required: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "required" }),
|
|
1702
|
-
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" })
|
|
1761
|
+
optional: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "optional" }),
|
|
1762
|
+
recommended: () => this.staticAssertions.push({ target, attribute, expectedValue, failureMessage: "", level: "recommended" })
|
|
1703
1763
|
})
|
|
1704
1764
|
})
|
|
1705
1765
|
};
|
|
@@ -1770,7 +1830,17 @@ var DynamicTestBuilder = class {
|
|
|
1770
1830
|
return this.parent;
|
|
1771
1831
|
}
|
|
1772
1832
|
_finalize() {
|
|
1773
|
-
const
|
|
1833
|
+
const capabilityMap = {
|
|
1834
|
+
keypress: "keyboard",
|
|
1835
|
+
click: "pointer",
|
|
1836
|
+
type: "textInput",
|
|
1837
|
+
focus: "keyboard",
|
|
1838
|
+
hover: "pointer"
|
|
1839
|
+
// add more mappings as needed
|
|
1840
|
+
};
|
|
1841
|
+
const capability = capabilityMap[this._as || "keyboard"] || (this._as || "keyboard");
|
|
1842
|
+
const ctx = { capabilities: [capability] };
|
|
1843
|
+
const resolveAllSetups = (stateName, visited = /* @__PURE__ */ new Set()) => {
|
|
1774
1844
|
if (visited.has(stateName)) return [];
|
|
1775
1845
|
visited.add(stateName);
|
|
1776
1846
|
const s = this.statePack[stateName];
|
|
@@ -1778,22 +1848,30 @@ var DynamicTestBuilder = class {
|
|
|
1778
1848
|
let actions = [];
|
|
1779
1849
|
if (Array.isArray(s.requires)) {
|
|
1780
1850
|
for (const req of s.requires) {
|
|
1781
|
-
actions = actions.concat(
|
|
1851
|
+
actions = actions.concat(resolveAllSetups(req, visited));
|
|
1782
1852
|
}
|
|
1783
1853
|
}
|
|
1784
|
-
if (s.setup) actions = actions.concat(s.setup);
|
|
1854
|
+
if (s.setup) actions = actions.concat(resolveSetup(s.setup, ctx));
|
|
1785
1855
|
return actions;
|
|
1786
1856
|
};
|
|
1787
1857
|
const setup = [];
|
|
1788
1858
|
for (const state of this._given) {
|
|
1789
|
-
setup.push(...
|
|
1859
|
+
setup.push(...resolveAllSetups(state));
|
|
1790
1860
|
}
|
|
1791
1861
|
const assertions = [];
|
|
1792
1862
|
for (const state of this._then) {
|
|
1793
1863
|
const s = this.statePack[state];
|
|
1794
|
-
if (s && s.assertion) {
|
|
1795
|
-
|
|
1796
|
-
|
|
1864
|
+
if (s && s.assertion !== void 0) {
|
|
1865
|
+
let value = s.assertion;
|
|
1866
|
+
if (typeof value === "function") {
|
|
1867
|
+
try {
|
|
1868
|
+
value = value();
|
|
1869
|
+
} catch (e) {
|
|
1870
|
+
throw new Error(`Error calling assertion function for state '${state}': ${e.message}`);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
if (Array.isArray(value)) assertions.push(...value);
|
|
1874
|
+
else assertions.push(value);
|
|
1797
1875
|
}
|
|
1798
1876
|
}
|
|
1799
1877
|
const action = [
|
|
@@ -1823,16 +1901,13 @@ import { axe } from "jest-axe";
|
|
|
1823
1901
|
|
|
1824
1902
|
// src/utils/test/src/contractTestRunner.ts
|
|
1825
1903
|
import fs from "fs/promises";
|
|
1826
|
-
async function runContractTests(componentName, component, strictness) {
|
|
1904
|
+
async function runContractTests(contractPath, componentName, component, strictness) {
|
|
1827
1905
|
const reporter = new ContractReporter(false);
|
|
1828
1906
|
const strictnessMode = normalizeStrictness(strictness);
|
|
1829
|
-
const contractTyped = contract_default;
|
|
1830
|
-
const contractPath = contractTyped[componentName]?.path;
|
|
1831
1907
|
if (!contractPath) {
|
|
1832
|
-
throw new Error(`No contract
|
|
1908
|
+
throw new Error(`No contract path provided for component: ${componentName}`);
|
|
1833
1909
|
}
|
|
1834
|
-
const
|
|
1835
|
-
const contractData = await fs.readFile(resolvedPath, "utf-8");
|
|
1910
|
+
const contractData = await fs.readFile(contractPath, "utf-8");
|
|
1836
1911
|
const componentContract = JSON.parse(contractData);
|
|
1837
1912
|
const totalTests = (componentContract.relationships?.length || 0) + (componentContract.static[0]?.assertions.length || 0) + componentContract.dynamic.length;
|
|
1838
1913
|
reporter.start(componentName, totalTests);
|
|
@@ -2032,7 +2107,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
|
|
|
2032
2107
|
let configBaseDir = typeof process !== "undefined" ? process.cwd() : "";
|
|
2033
2108
|
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
2034
2109
|
try {
|
|
2035
|
-
const { loadConfig } = await import("./configLoader-
|
|
2110
|
+
const { loadConfig } = await import("./configLoader-Q7N5XV4P.js");
|
|
2036
2111
|
const result2 = await loadConfig(process.cwd());
|
|
2037
2112
|
config = result2.config;
|
|
2038
2113
|
if (result2.configPath) {
|
|
@@ -2054,7 +2129,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
|
|
|
2054
2129
|
const devServerUrl = await checkDevServer(url);
|
|
2055
2130
|
if (devServerUrl) {
|
|
2056
2131
|
console.log(`\u{1F3AD} Running Playwright tests on ${devServerUrl}`);
|
|
2057
|
-
const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-
|
|
2132
|
+
const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-DIXP5DQ3.js");
|
|
2058
2133
|
contract = await runContractTestsPlaywright(componentName, devServerUrl, strictness, config, configBaseDir);
|
|
2059
2134
|
} else {
|
|
2060
2135
|
throw new Error(
|
|
@@ -2064,7 +2139,16 @@ Please start your dev server and try again.`
|
|
|
2064
2139
|
}
|
|
2065
2140
|
} else if (component) {
|
|
2066
2141
|
console.log(`\u{1F3AD} Running component contract tests in JSDOM mode`);
|
|
2067
|
-
|
|
2142
|
+
const contractPath = config.test?.components?.find((comp) => comp?.name === componentName)?.contractPath;
|
|
2143
|
+
if (!contractPath) {
|
|
2144
|
+
throw new Error(`\u274C No contract path found for component: ${componentName}`);
|
|
2145
|
+
}
|
|
2146
|
+
contract = await runContractTests(
|
|
2147
|
+
path.resolve(configBaseDir, contractPath),
|
|
2148
|
+
componentName,
|
|
2149
|
+
component,
|
|
2150
|
+
strictness
|
|
2151
|
+
);
|
|
2068
2152
|
} else {
|
|
2069
2153
|
throw new Error("\u274C Either component or URL must be provided");
|
|
2070
2154
|
}
|
|
@@ -88,4 +88,4 @@ interface MenuCallback {
|
|
|
88
88
|
onOpenChange?: (isOpen: boolean) => void;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export type {
|
|
91
|
+
export type { AccordionConfig as A, ComboboxConfig as C, MenuConfig as M, TabsConfig as T, AccessibilityInstance as a };
|
|
@@ -88,4 +88,4 @@ interface MenuCallback {
|
|
|
88
88
|
onOpenChange?: (isOpen: boolean) => void;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export type {
|
|
91
|
+
export type { AccordionConfig as A, ComboboxConfig as C, MenuConfig as M, TabsConfig as T, AccessibilityInstance as a };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as AccordionConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes an accordion accessible by managing ARIA attributes, keyboard interaction, and state.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComboboxConfig,
|
|
1
|
+
import { C as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComboboxConfig,
|
|
1
|
+
import { C as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/menu/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/tabs/index.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import { chromium } from 'playwright';
|
|
2
2
|
|
|
3
|
-
// src/utils/test/contract/contract.json
|
|
4
|
-
var contract_default = {
|
|
5
|
-
menu: {
|
|
6
|
-
path: "./aria-contracts/menu/menu.contract.json",
|
|
7
|
-
component: "menu"
|
|
8
|
-
},
|
|
9
|
-
"combobox.listbox": {
|
|
10
|
-
path: "./aria-contracts/combobox/combobox.listbox.contract.json",
|
|
11
|
-
component: "combobox.listbox"
|
|
12
|
-
},
|
|
13
|
-
accordion: {
|
|
14
|
-
path: "./aria-contracts/accordion/accordion.contract.json",
|
|
15
|
-
component: "accordion"
|
|
16
|
-
},
|
|
17
|
-
tabs: {
|
|
18
|
-
path: "./aria-contracts/tabs/tabs.contract.json",
|
|
19
|
-
component: "tabs"
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
3
|
// src/utils/test/src/ContractReporter.ts
|
|
24
4
|
var ContractReporter = class {
|
|
25
5
|
startTime = 0;
|
|
@@ -351,4 +331,4 @@ async function closeSharedBrowser() {
|
|
|
351
331
|
}
|
|
352
332
|
}
|
|
353
333
|
|
|
354
|
-
export { ContractReporter, closeSharedBrowser,
|
|
334
|
+
export { ContractReporter, closeSharedBrowser, createTestPage, normalizeLevel, normalizeStrictness, resolveEnforcement };
|
|
@@ -69,8 +69,8 @@ function validateConfig(config) {
|
|
|
69
69
|
if (typeof comp.name !== "string") {
|
|
70
70
|
errors.push(`test.components[${idx}].name must be a string`);
|
|
71
71
|
}
|
|
72
|
-
if (comp.
|
|
73
|
-
errors.push(`test.components[${idx}].
|
|
72
|
+
if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
|
|
73
|
+
errors.push(`test.components[${idx}].contractPath must be a string when provided`);
|
|
74
74
|
}
|
|
75
75
|
if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
|
|
76
76
|
errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractReporter, normalizeStrictness, createTestPage, normalizeLevel, resolveEnforcement } from './chunk-FZ7GMIJB.js';
|
|
2
2
|
import { readFileSync } from 'fs';
|
|
3
3
|
import path2 from 'path';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
@@ -37,12 +37,6 @@ var StrategyRegistry = class {
|
|
|
37
37
|
(m) => m.TabsComponentStrategy
|
|
38
38
|
)
|
|
39
39
|
);
|
|
40
|
-
this.builtInStrategies.set(
|
|
41
|
-
"combobox.listbox",
|
|
42
|
-
() => import('./ComboboxComponentStrategy-5AECQSRN.js').then(
|
|
43
|
-
(m) => m.ComboboxComponentStrategy
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
40
|
}
|
|
47
41
|
/**
|
|
48
42
|
* Load a strategy - either from custom path or built-in registry
|
|
@@ -106,11 +100,7 @@ var ComponentDetector = class {
|
|
|
106
100
|
*/
|
|
107
101
|
static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
|
|
108
102
|
const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
|
|
109
|
-
|
|
110
|
-
if (!contractPath) {
|
|
111
|
-
const contractTyped = contract_default;
|
|
112
|
-
contractPath = contractTyped[componentName]?.path;
|
|
113
|
-
}
|
|
103
|
+
const contractPath = typedComponentConfig?.contractPath;
|
|
114
104
|
if (!contractPath) {
|
|
115
105
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
116
106
|
}
|
|
@@ -143,7 +133,7 @@ var ComponentDetector = class {
|
|
|
143
133
|
if (!strategyClass) {
|
|
144
134
|
return null;
|
|
145
135
|
}
|
|
146
|
-
const mainSelector = selectors.
|
|
136
|
+
const mainSelector = selectors.main;
|
|
147
137
|
if (componentName === "tabs") {
|
|
148
138
|
return new strategyClass(mainSelector, selectors);
|
|
149
139
|
}
|
|
@@ -689,7 +679,7 @@ var AssertionRunner = class {
|
|
|
689
679
|
// src/utils/test/src/contractTestRunnerPlaywright.ts
|
|
690
680
|
async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
|
|
691
681
|
const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
|
|
692
|
-
const isCustomContract = !!componentConfig?.
|
|
682
|
+
const isCustomContract = !!componentConfig?.contractPath;
|
|
693
683
|
const reporter = new ContractReporter(true, isCustomContract);
|
|
694
684
|
const defaultTimeouts = {
|
|
695
685
|
actionTimeoutMs: 400,
|
|
@@ -729,11 +719,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
|
|
|
729
719
|
defaultTimeouts.componentReadyTimeoutMs
|
|
730
720
|
);
|
|
731
721
|
const strictnessMode = normalizeStrictness(strictness);
|
|
732
|
-
|
|
733
|
-
if (!contractPath) {
|
|
734
|
-
const contractTyped = contract_default;
|
|
735
|
-
contractPath = contractTyped[componentName]?.path;
|
|
736
|
-
}
|
|
722
|
+
const contractPath = componentConfig?.contractPath;
|
|
737
723
|
if (!contractPath) {
|
|
738
724
|
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
739
725
|
}
|