accented 0.0.0-20250404114312 → 0.0.0-20250618181418

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.
Files changed (207) hide show
  1. package/README.md +0 -207
  2. package/dist/accented.d.ts +2 -2
  3. package/dist/accented.d.ts.map +1 -1
  4. package/dist/accented.js +29 -23
  5. package/dist/accented.js.map +1 -1
  6. package/dist/common/tokens.d.ts +2 -0
  7. package/dist/common/tokens.d.ts.map +1 -0
  8. package/dist/common/tokens.js +2 -0
  9. package/dist/common/tokens.js.map +1 -0
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/dom-updater.d.ts +1 -1
  12. package/dist/dom-updater.d.ts.map +1 -1
  13. package/dist/dom-updater.js +43 -16
  14. package/dist/dom-updater.js.map +1 -1
  15. package/dist/elements/accented-dialog.d.ts +13 -10
  16. package/dist/elements/accented-dialog.d.ts.map +1 -1
  17. package/dist/elements/accented-dialog.js +46 -69
  18. package/dist/elements/accented-dialog.js.map +1 -1
  19. package/dist/elements/accented-trigger.d.ts +12 -9
  20. package/dist/elements/accented-trigger.d.ts.map +1 -1
  21. package/dist/elements/accented-trigger.js +14 -15
  22. package/dist/elements/accented-trigger.js.map +1 -1
  23. package/dist/fullscreen-listener.d.ts +1 -1
  24. package/dist/fullscreen-listener.d.ts.map +1 -1
  25. package/dist/fullscreen-listener.js +3 -4
  26. package/dist/fullscreen-listener.js.map +1 -1
  27. package/dist/intersection-observer.d.ts +1 -1
  28. package/dist/intersection-observer.d.ts.map +1 -1
  29. package/dist/intersection-observer.js +12 -6
  30. package/dist/intersection-observer.js.map +1 -1
  31. package/dist/log-and-rethrow.d.ts +1 -1
  32. package/dist/log-and-rethrow.d.ts.map +1 -1
  33. package/dist/log-and-rethrow.js +2 -3
  34. package/dist/log-and-rethrow.js.map +1 -1
  35. package/dist/logger.d.ts +1 -1
  36. package/dist/logger.d.ts.map +1 -1
  37. package/dist/logger.js +6 -3
  38. package/dist/logger.js.map +1 -1
  39. package/dist/register-elements.d.ts +1 -1
  40. package/dist/register-elements.d.ts.map +1 -1
  41. package/dist/register-elements.js +6 -7
  42. package/dist/register-elements.js.map +1 -1
  43. package/dist/resize-listener.d.ts +1 -1
  44. package/dist/resize-listener.d.ts.map +1 -1
  45. package/dist/resize-listener.js +3 -4
  46. package/dist/resize-listener.js.map +1 -1
  47. package/dist/scanner.d.ts +2 -2
  48. package/dist/scanner.d.ts.map +1 -1
  49. package/dist/scanner.js +39 -36
  50. package/dist/scanner.js.map +1 -1
  51. package/dist/scroll-listeners.d.ts +1 -1
  52. package/dist/scroll-listeners.d.ts.map +1 -1
  53. package/dist/scroll-listeners.js +3 -4
  54. package/dist/scroll-listeners.js.map +1 -1
  55. package/dist/state.d.ts +1 -1
  56. package/dist/state.d.ts.map +1 -1
  57. package/dist/state.js +4 -5
  58. package/dist/state.js.map +1 -1
  59. package/dist/task-queue.d.ts +4 -4
  60. package/dist/task-queue.d.ts.map +1 -1
  61. package/dist/task-queue.js +3 -2
  62. package/dist/task-queue.js.map +1 -1
  63. package/dist/types.d.ts +28 -6
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/types.js.map +1 -1
  66. package/dist/utils/are-elements-with-issues-equal.d.ts +2 -2
  67. package/dist/utils/are-elements-with-issues-equal.d.ts.map +1 -1
  68. package/dist/utils/are-elements-with-issues-equal.js +3 -3
  69. package/dist/utils/are-elements-with-issues-equal.js.map +1 -1
  70. package/dist/utils/are-issue-sets-equal.d.ts +2 -2
  71. package/dist/utils/are-issue-sets-equal.d.ts.map +1 -1
  72. package/dist/utils/are-issue-sets-equal.js +3 -3
  73. package/dist/utils/are-issue-sets-equal.js.map +1 -1
  74. package/dist/utils/containing-blocks.d.ts +3 -0
  75. package/dist/utils/containing-blocks.d.ts.map +1 -0
  76. package/dist/utils/containing-blocks.js +46 -0
  77. package/dist/utils/containing-blocks.js.map +1 -0
  78. package/dist/utils/contains.d.ts +2 -0
  79. package/dist/utils/contains.d.ts.map +1 -0
  80. package/dist/utils/contains.js +19 -0
  81. package/dist/utils/contains.js.map +1 -0
  82. package/dist/utils/deduplicate-nodes.d.ts +2 -0
  83. package/dist/utils/deduplicate-nodes.d.ts.map +1 -0
  84. package/dist/utils/deduplicate-nodes.js +4 -0
  85. package/dist/utils/deduplicate-nodes.js.map +1 -0
  86. package/dist/utils/deep-merge.d.ts +1 -1
  87. package/dist/utils/deep-merge.d.ts.map +1 -1
  88. package/dist/utils/deep-merge.js +6 -5
  89. package/dist/utils/deep-merge.js.map +1 -1
  90. package/dist/utils/dom-helpers.d.ts +3 -0
  91. package/dist/utils/dom-helpers.d.ts.map +1 -1
  92. package/dist/utils/dom-helpers.js +15 -0
  93. package/dist/utils/dom-helpers.js.map +1 -1
  94. package/dist/utils/ensure-non-empty.d.ts +2 -0
  95. package/dist/utils/ensure-non-empty.d.ts.map +1 -0
  96. package/dist/utils/ensure-non-empty.js +7 -0
  97. package/dist/utils/ensure-non-empty.js.map +1 -0
  98. package/dist/utils/get-element-html.d.ts +1 -1
  99. package/dist/utils/get-element-html.d.ts.map +1 -1
  100. package/dist/utils/get-element-html.js +4 -2
  101. package/dist/utils/get-element-html.js.map +1 -1
  102. package/dist/utils/get-element-position.d.ts +10 -2
  103. package/dist/utils/get-element-position.d.ts.map +1 -1
  104. package/dist/utils/get-element-position.js +34 -23
  105. package/dist/utils/get-element-position.js.map +1 -1
  106. package/dist/utils/get-parent.d.ts +1 -1
  107. package/dist/utils/get-parent.d.ts.map +1 -1
  108. package/dist/utils/get-parent.js +1 -1
  109. package/dist/utils/get-parent.js.map +1 -1
  110. package/dist/utils/get-scan-context.d.ts +3 -0
  111. package/dist/utils/get-scan-context.d.ts.map +1 -0
  112. package/dist/utils/get-scan-context.js +28 -0
  113. package/dist/utils/get-scan-context.js.map +1 -0
  114. package/dist/utils/get-scrollable-ancestors.d.ts +1 -1
  115. package/dist/utils/get-scrollable-ancestors.d.ts.map +1 -1
  116. package/dist/utils/get-scrollable-ancestors.js +5 -5
  117. package/dist/utils/get-scrollable-ancestors.js.map +1 -1
  118. package/dist/utils/is-node-in-scan-context.d.ts +3 -0
  119. package/dist/utils/is-node-in-scan-context.d.ts.map +1 -0
  120. package/dist/utils/is-node-in-scan-context.js +26 -0
  121. package/dist/utils/is-node-in-scan-context.js.map +1 -0
  122. package/dist/utils/is-non-empty.d.ts +2 -0
  123. package/dist/utils/is-non-empty.d.ts.map +1 -0
  124. package/dist/utils/is-non-empty.js +4 -0
  125. package/dist/utils/is-non-empty.js.map +1 -0
  126. package/dist/utils/normalize-context.d.ts +3 -0
  127. package/dist/utils/normalize-context.d.ts.map +1 -0
  128. package/dist/utils/normalize-context.js +59 -0
  129. package/dist/utils/normalize-context.js.map +1 -0
  130. package/dist/utils/recalculate-positions.d.ts +1 -1
  131. package/dist/utils/recalculate-positions.d.ts.map +1 -1
  132. package/dist/utils/recalculate-positions.js +5 -5
  133. package/dist/utils/recalculate-positions.js.map +1 -1
  134. package/dist/utils/recalculate-scrollable-ancestors.d.ts +1 -1
  135. package/dist/utils/recalculate-scrollable-ancestors.d.ts.map +1 -1
  136. package/dist/utils/recalculate-scrollable-ancestors.js +4 -4
  137. package/dist/utils/recalculate-scrollable-ancestors.js.map +1 -1
  138. package/dist/utils/shadow-dom-aware-mutation-observer.d.ts +1 -1
  139. package/dist/utils/shadow-dom-aware-mutation-observer.d.ts.map +1 -1
  140. package/dist/utils/shadow-dom-aware-mutation-observer.js +19 -22
  141. package/dist/utils/shadow-dom-aware-mutation-observer.js.map +1 -1
  142. package/dist/utils/supports-anchor-positioning.d.ts +1 -1
  143. package/dist/utils/supports-anchor-positioning.d.ts.map +1 -1
  144. package/dist/utils/supports-anchor-positioning.js +1 -1
  145. package/dist/utils/supports-anchor-positioning.js.map +1 -1
  146. package/dist/utils/transform-violations.d.ts +2 -2
  147. package/dist/utils/transform-violations.d.ts.map +1 -1
  148. package/dist/utils/transform-violations.js +9 -9
  149. package/dist/utils/transform-violations.js.map +1 -1
  150. package/dist/utils/update-elements-with-issues.d.ts +11 -5
  151. package/dist/utils/update-elements-with-issues.d.ts.map +1 -1
  152. package/dist/utils/update-elements-with-issues.js +54 -26
  153. package/dist/utils/update-elements-with-issues.js.map +1 -1
  154. package/dist/validate-options.d.ts +2 -2
  155. package/dist/validate-options.d.ts.map +1 -1
  156. package/dist/validate-options.js +91 -4
  157. package/dist/validate-options.js.map +1 -1
  158. package/package.json +11 -5
  159. package/src/accented.test.ts +2 -2
  160. package/src/accented.ts +38 -28
  161. package/src/common/tokens.ts +1 -0
  162. package/src/dom-updater.ts +59 -22
  163. package/src/elements/accented-dialog.ts +102 -106
  164. package/src/elements/accented-trigger.ts +58 -48
  165. package/src/fullscreen-listener.ts +15 -11
  166. package/src/intersection-observer.ts +27 -16
  167. package/src/log-and-rethrow.ts +2 -3
  168. package/src/logger.ts +14 -4
  169. package/src/register-elements.ts +7 -7
  170. package/src/resize-listener.ts +15 -11
  171. package/src/scanner.ts +70 -50
  172. package/src/scroll-listeners.ts +27 -19
  173. package/src/state.ts +24 -21
  174. package/src/task-queue.test.ts +5 -4
  175. package/src/task-queue.ts +8 -6
  176. package/src/types.ts +74 -42
  177. package/src/utils/are-elements-with-issues-equal.ts +7 -5
  178. package/src/utils/are-issue-sets-equal.test.ts +10 -6
  179. package/src/utils/are-issue-sets-equal.ts +8 -6
  180. package/src/utils/containing-blocks.ts +60 -0
  181. package/src/utils/contains.test.ts +55 -0
  182. package/src/utils/contains.ts +19 -0
  183. package/src/utils/deduplicate-nodes.ts +3 -0
  184. package/src/utils/deep-merge.test.ts +8 -1
  185. package/src/utils/deep-merge.ts +11 -8
  186. package/src/utils/dom-helpers.ts +20 -0
  187. package/src/utils/ensure-non-empty.ts +6 -0
  188. package/src/utils/get-element-html.ts +4 -2
  189. package/src/utils/get-element-position.ts +51 -22
  190. package/src/utils/get-parent.ts +1 -1
  191. package/src/utils/get-scan-context.test.ts +85 -0
  192. package/src/utils/get-scan-context.ts +36 -0
  193. package/src/utils/get-scrollable-ancestors.ts +8 -5
  194. package/src/utils/is-node-in-scan-context.test.ts +70 -0
  195. package/src/utils/is-node-in-scan-context.ts +29 -0
  196. package/src/utils/is-non-empty.ts +3 -0
  197. package/src/utils/normalize-context.test.ts +105 -0
  198. package/src/utils/normalize-context.ts +65 -0
  199. package/src/utils/recalculate-positions.ts +5 -5
  200. package/src/utils/recalculate-scrollable-ancestors.ts +4 -4
  201. package/src/utils/shadow-dom-aware-mutation-observer.ts +21 -24
  202. package/src/utils/supports-anchor-positioning.ts +3 -3
  203. package/src/utils/transform-violations.test.ts +22 -20
  204. package/src/utils/transform-violations.ts +14 -10
  205. package/src/utils/update-elements-with-issues.test.ts +102 -49
  206. package/src/utils/update-elements-with-issues.ts +122 -58
  207. package/src/validate-options.ts +154 -14
@@ -1,7 +1,7 @@
1
1
  type WindowWithCSS = Window & {
2
- CSS: typeof CSS
3
- }
2
+ CSS: typeof CSS;
3
+ };
4
4
 
5
- export default function supportsAnchorPositioning(win: WindowWithCSS) {
5
+ export function supportsAnchorPositioning(win: WindowWithCSS) {
6
6
  return win.CSS.supports('anchor-name: --foo') && win.CSS.supports('position-anchor: --foo');
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import assert from 'node:assert/strict';
2
- import {suite, test} from 'node:test';
3
- import transformViolations from './transform-violations';
2
+ import { suite, test } from 'node:test';
3
+ import { transformViolations } from './transform-violations';
4
4
 
5
5
  import type { AxeResults } from 'axe-core';
6
6
  type Violation = AxeResults['violations'][number];
@@ -12,7 +12,7 @@ const commonViolationProps1: Omit<Violation, 'nodes'> = {
12
12
  helpUrl: 'http://example.com',
13
13
  description: 'description1',
14
14
  tags: [],
15
- impact: 'serious'
15
+ impact: 'serious',
16
16
  };
17
17
 
18
18
  const commonViolationProps2: Omit<Violation, 'nodes'> = {
@@ -21,51 +21,51 @@ const commonViolationProps2: Omit<Violation, 'nodes'> = {
21
21
  helpUrl: 'http://example.com',
22
22
  description: 'description2',
23
23
  tags: [],
24
- impact: 'serious'
24
+ impact: 'serious',
25
25
  };
26
26
 
27
- const getRootNode = (): Node => ({} as Node);
27
+ const getRootNode = (): Node => ({}) as Node;
28
28
 
29
29
  // @ts-expect-error element is not HTMLElement
30
- const element1: HTMLElement = {getRootNode};
30
+ const element1: HTMLElement = { getRootNode };
31
31
  // @ts-expect-error element is not HTMLElement
32
- const element2: HTMLElement = {getRootNode};
32
+ const element2: HTMLElement = { getRootNode };
33
33
  // @ts-expect-error element is not HTMLElement
34
- const element3: HTMLElement = {getRootNode};
34
+ const element3: HTMLElement = { getRootNode };
35
35
 
36
36
  const commonNodeProps = {
37
37
  html: '<div></div>',
38
38
  any: [],
39
39
  all: [],
40
- none: []
40
+ none: [],
41
41
  };
42
42
 
43
43
  const node1: Node = {
44
44
  ...commonNodeProps,
45
45
  element: element1,
46
46
  target: ['div'],
47
- failureSummary: 'summary1'
47
+ failureSummary: 'summary1',
48
48
  };
49
49
 
50
50
  const node2: Node = {
51
51
  ...commonNodeProps,
52
52
  element: element2,
53
53
  target: ['div'],
54
- failureSummary: 'summary2'
54
+ failureSummary: 'summary2',
55
55
  };
56
56
 
57
57
  const node3: Node = {
58
58
  ...commonNodeProps,
59
59
  element: element3,
60
60
  target: ['div'],
61
- failureSummary: 'summary3'
61
+ failureSummary: 'summary3',
62
62
  };
63
63
 
64
64
  suite('transformViolations', () => {
65
65
  test('one violation, one element', () => {
66
66
  const violation: Violation = {
67
67
  ...commonViolationProps1,
68
- nodes: [node1]
68
+ nodes: [node1],
69
69
  };
70
70
  const elementsWithIssues = transformViolations([violation], 'accented');
71
71
  assert.equal(elementsWithIssues.length, 1);
@@ -78,15 +78,17 @@ suite('transformViolations', () => {
78
78
  test('two violations, two elements each', () => {
79
79
  const violation1: Violation = {
80
80
  ...commonViolationProps1,
81
- nodes: [node1, node2]
81
+ nodes: [node1, node2],
82
82
  };
83
83
  const violation2: Violation = {
84
84
  ...commonViolationProps2,
85
- nodes: [node1, node3]
85
+ nodes: [node1, node3],
86
86
  };
87
87
  const elementsWithIssues = transformViolations([violation1, violation2], 'accented');
88
88
  assert.equal(elementsWithIssues.length, 3);
89
- const elementWithTwoIssues = elementsWithIssues.find(elementWithIssues => elementWithIssues.element === element1);
89
+ const elementWithTwoIssues = elementsWithIssues.find(
90
+ (elementWithIssues) => elementWithIssues.element === element1,
91
+ );
90
92
  assert.equal(elementWithTwoIssues?.issues.length, 2);
91
93
  });
92
94
 
@@ -96,11 +98,11 @@ suite('transformViolations', () => {
96
98
  element: element1,
97
99
  // A target array whose length is > 1 signifies an element in an iframe
98
100
  target: ['iframe', 'div'],
99
- failureSummary: 'summary1'
101
+ failureSummary: 'summary1',
100
102
  };
101
103
  const violation: Violation = {
102
104
  ...commonViolationProps1,
103
- nodes: [node]
105
+ nodes: [node],
104
106
  };
105
107
 
106
108
  const elementsWithIssues = transformViolations([violation], 'accented');
@@ -113,11 +115,11 @@ suite('transformViolations', () => {
113
115
  element: element1,
114
116
  // A target that contains an array within the outer array signifies an element in shadow DOM
115
117
  target: [['div', 'div']],
116
- failureSummary: 'summary1'
118
+ failureSummary: 'summary1',
117
119
  };
118
120
  const violation: Violation = {
119
121
  ...commonViolationProps1,
120
- nodes: [node]
122
+ nodes: [node],
121
123
  };
122
124
 
123
125
  const elementsWithIssues = transformViolations([violation], 'accented');
@@ -1,5 +1,5 @@
1
1
  import type { AxeResults, ImpactValue } from 'axe-core';
2
- import type { Issue, ElementWithIssues } from '../types';
2
+ import type { ElementWithIssues, Issue } from '../types.ts';
3
3
 
4
4
  // This is a list of axe-core violations (their ids) that may be flagged by axe-core
5
5
  // as false positives if an Accented trigger is a descendant of the element with the issue.
@@ -10,12 +10,14 @@ const violationsAffectedByAccentedTriggers = [
10
10
  'label-content-name-mismatch',
11
11
  'list',
12
12
  'nested-interactive',
13
- 'scrollable-region-focusable' // The Accented trigger might make the content grow such that scrolling is required.
13
+ 'scrollable-region-focusable', // The Accented trigger might make the content grow such that scrolling is required.
14
14
  ];
15
15
 
16
16
  function maybeCausedByAccented(violationId: string, element: HTMLElement, name: string) {
17
- return violationsAffectedByAccentedTriggers.includes(violationId)
18
- && Boolean(element.querySelector(`${name}-trigger`));
17
+ return (
18
+ violationsAffectedByAccentedTriggers.includes(violationId) &&
19
+ Boolean(element.querySelector(`${name}-trigger`))
20
+ );
19
21
  }
20
22
 
21
23
  function impactCompare(a: ImpactValue, b: ImpactValue) {
@@ -23,7 +25,7 @@ function impactCompare(a: ImpactValue, b: ImpactValue) {
23
25
  return impactOrder.indexOf(a) - impactOrder.indexOf(b);
24
26
  }
25
27
 
26
- export default function transformViolations(violations: typeof AxeResults.violations, name: string) {
28
+ export function transformViolations(violations: typeof AxeResults.violations, name: string) {
27
29
  const elementsWithIssues: Array<ElementWithIssues> = [];
28
30
 
29
31
  for (const violation of violations) {
@@ -44,17 +46,19 @@ export default function transformViolations(violations: typeof AxeResults.violat
44
46
  title: violation.help,
45
47
  description: node.failureSummary ?? violation.description,
46
48
  url: violation.helpUrl,
47
- impact: violation.impact ?? null
49
+ impact: violation.impact ?? null,
48
50
  };
49
- const existingElementIndex = elementsWithIssues.findIndex(elementWithIssues => elementWithIssues.element === element);
50
- if (existingElementIndex === -1) {
51
+ const existingElement = elementsWithIssues.find(
52
+ (elementWithIssues) => elementWithIssues.element === element,
53
+ );
54
+ if (existingElement === undefined) {
51
55
  elementsWithIssues.push({
52
56
  element,
53
57
  rootNode: element.getRootNode(),
54
- issues: [issue]
58
+ issues: [issue],
55
59
  });
56
60
  } else {
57
- elementsWithIssues[existingElementIndex]!.issues.push(issue);
61
+ existingElement.issues.push(issue);
58
62
  }
59
63
  }
60
64
  }
@@ -1,9 +1,9 @@
1
- import {suite, test} from 'node:test';
2
1
  import assert from 'node:assert/strict';
2
+ import { suite, test } from 'node:test';
3
3
  import type { Signal } from '@preact/signals-core';
4
4
  import { signal } from '@preact/signals-core';
5
5
  import type { ExtendedElementWithIssues, Issue } from '../types';
6
- import updateElementsWithIssues from './update-elements-with-issues';
6
+ import { updateElementsWithIssues } from './update-elements-with-issues';
7
7
 
8
8
  import type { AxeResults, ImpactValue } from 'axe-core';
9
9
  import type { AccentedTrigger } from '../elements/accented-trigger';
@@ -15,41 +15,43 @@ const win: Window & { CSS: typeof CSS } = {
15
15
  // @ts-expect-error the return value is of incorrect type.
16
16
  createElement: () => ({
17
17
  style: {
18
- setProperty: () => {}
18
+ setProperty: () => {},
19
19
  },
20
- dataset: {}
21
- })
20
+ dataset: {},
21
+ }),
22
+ contains: () => true,
22
23
  },
23
24
  // @ts-expect-error we're missing a lot of properties
24
25
  getComputedStyle: () => ({
25
26
  zIndex: '',
26
27
  direction: 'ltr',
27
- getPropertyValue: () => 'none'
28
+ getPropertyValue: () => 'none',
28
29
  }),
29
30
  // @ts-expect-error we're missing a lot of properties
30
31
  CSS: {
31
- supports: () => true
32
- }
33
- }
32
+ supports: () => true,
33
+ },
34
+ };
34
35
 
35
36
  const getBoundingClientRect = () => ({});
36
37
 
37
- const getRootNode = (): Node => ({} as Node);
38
+ const getRootNode = (): Node => ({}) as Node;
38
39
 
39
40
  const baseElement = {
40
41
  getBoundingClientRect,
41
42
  getRootNode,
42
43
  style: {
43
- getPropertyValue: () => ''
44
- }
45
- }
44
+ getPropertyValue: () => '',
45
+ },
46
+ closest: () => null,
47
+ };
46
48
 
47
49
  // @ts-expect-error element is not HTMLElement
48
- const element1: HTMLElement = {...baseElement, isConnected: true};
50
+ const element1: HTMLElement = { ...baseElement, isConnected: true };
49
51
  // @ts-expect-error element is not HTMLElement
50
- const element2: HTMLElement = {...baseElement, isConnected: true};
52
+ const element2: HTMLElement = { ...baseElement, isConnected: true };
51
53
  // @ts-expect-error element is not HTMLElement
52
- const element3: HTMLElement = {...baseElement, isConnected: false};
54
+ const element3: HTMLElement = { ...baseElement, isConnected: false };
53
55
 
54
56
  // @ts-expect-error rootNode is not Node
55
57
  const rootNode: Node = {};
@@ -60,7 +62,7 @@ const position = signal({
60
62
  left: 0,
61
63
  width: 100,
62
64
  top: 0,
63
- height: 100
65
+ height: 100,
64
66
  });
65
67
 
66
68
  const visible = signal(true);
@@ -72,7 +74,7 @@ const commonNodeProps = {
72
74
  any: [],
73
75
  all: [],
74
76
  none: [],
75
- target: ['div']
77
+ target: ['div'],
76
78
  };
77
79
 
78
80
  const node1: AxeNode = {
@@ -95,53 +97,58 @@ const commonViolationProps = {
95
97
  helpUrl: 'http://example.com',
96
98
  description: 'description',
97
99
  tags: [],
98
- impact: 'serious' as ImpactValue
100
+ impact: 'serious' as ImpactValue,
99
101
  };
100
102
 
101
103
  const violation1: Violation = {
102
104
  ...commonViolationProps,
103
105
  id: 'id1',
104
- nodes: [node1]
106
+ nodes: [node1],
105
107
  };
106
108
 
107
109
  const violation2: Violation = {
108
110
  ...commonViolationProps,
109
111
  id: 'id2',
110
- nodes: [node2]
112
+ nodes: [node2],
111
113
  };
112
114
 
113
115
  const violation3: Violation = {
114
116
  ...commonViolationProps,
115
117
  id: 'id3',
116
- nodes: [node2]
118
+ nodes: [node2],
117
119
  };
118
120
 
119
121
  const violation4: Violation = {
120
122
  ...commonViolationProps,
121
123
  id: 'id4',
122
- nodes: [node3]
124
+ nodes: [node3],
123
125
  };
124
126
 
125
127
  const commonIssueProps = {
126
128
  title: 'help',
127
129
  description: 'description',
128
130
  url: 'http://example.com',
129
- impact: 'serious'
131
+ impact: 'serious',
130
132
  } as const;
131
133
 
132
134
  const issue1: Issue = {
133
135
  id: 'id1',
134
- ...commonIssueProps
136
+ ...commonIssueProps,
135
137
  };
136
138
 
137
139
  const issue2: Issue = {
138
140
  id: 'id2',
139
- ...commonIssueProps
141
+ ...commonIssueProps,
140
142
  };
141
143
 
142
144
  const issue3: Issue = {
143
145
  id: 'id3',
144
- ...commonIssueProps
146
+ ...commonIssueProps,
147
+ };
148
+
149
+ const scanContext = {
150
+ include: [win.document],
151
+ exclude: [],
145
152
  };
146
153
 
147
154
  suite('updateElementsWithIssues', () => {
@@ -151,26 +158,34 @@ suite('updateElementsWithIssues', () => {
151
158
  id: 1,
152
159
  element: element1,
153
160
  rootNode,
161
+ skipRender: false,
154
162
  position,
155
163
  visible,
156
164
  trigger,
157
165
  anchorNameValue: 'none',
158
166
  scrollableAncestors,
159
- issues: signal([issue1])
167
+ issues: signal([issue1]),
160
168
  },
161
169
  {
162
170
  id: 2,
163
171
  element: element2,
164
172
  rootNode,
173
+ skipRender: false,
165
174
  position,
166
175
  visible,
167
176
  trigger,
168
177
  anchorNameValue: 'none',
169
178
  scrollableAncestors,
170
- issues: signal([issue2])
171
- }
179
+ issues: signal([issue2]),
180
+ },
172
181
  ]);
173
- updateElementsWithIssues(extendedElementsWithIssues, [violation1, violation2], win, 'accented');
182
+ updateElementsWithIssues({
183
+ extendedElementsWithIssues,
184
+ scanContext,
185
+ violations: [violation1, violation2],
186
+ win,
187
+ name: 'accented',
188
+ });
174
189
  assert.equal(extendedElementsWithIssues.value.length, 2);
175
190
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
176
191
  assert.equal(extendedElementsWithIssues.value[0]?.issues.value.length, 1);
@@ -184,26 +199,34 @@ suite('updateElementsWithIssues', () => {
184
199
  id: 1,
185
200
  element: element1,
186
201
  rootNode,
202
+ skipRender: false,
187
203
  position,
188
204
  visible,
189
205
  trigger,
190
206
  anchorNameValue: 'none',
191
207
  scrollableAncestors,
192
- issues: signal([issue1])
208
+ issues: signal([issue1]),
193
209
  },
194
210
  {
195
211
  id: 2,
196
212
  element: element2,
197
213
  rootNode,
214
+ skipRender: false,
198
215
  position,
199
216
  visible,
200
217
  trigger,
201
218
  anchorNameValue: 'none',
202
219
  scrollableAncestors,
203
- issues: signal([issue2])
204
- }
220
+ issues: signal([issue2]),
221
+ },
205
222
  ]);
206
- updateElementsWithIssues(extendedElementsWithIssues, [violation1, violation2, violation3], win, 'accented');
223
+ updateElementsWithIssues({
224
+ extendedElementsWithIssues,
225
+ scanContext,
226
+ violations: [violation1, violation2, violation3],
227
+ win,
228
+ name: 'accented',
229
+ });
207
230
  assert.equal(extendedElementsWithIssues.value.length, 2);
208
231
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
209
232
  assert.equal(extendedElementsWithIssues.value[0]?.issues.value.length, 1);
@@ -217,26 +240,34 @@ suite('updateElementsWithIssues', () => {
217
240
  id: 1,
218
241
  element: element1,
219
242
  rootNode,
243
+ skipRender: false,
220
244
  position,
221
245
  visible,
222
246
  trigger,
223
247
  anchorNameValue: 'none',
224
248
  scrollableAncestors,
225
- issues: signal([issue1])
249
+ issues: signal([issue1]),
226
250
  },
227
251
  {
228
252
  id: 2,
229
253
  element: element2,
230
254
  rootNode,
255
+ skipRender: false,
231
256
  position,
232
257
  visible,
233
258
  trigger,
234
259
  anchorNameValue: 'none',
235
260
  scrollableAncestors,
236
- issues: signal([issue2, issue3])
237
- }
261
+ issues: signal([issue2, issue3]),
262
+ },
238
263
  ]);
239
- updateElementsWithIssues(extendedElementsWithIssues, [violation1, violation2], win, 'accented');
264
+ updateElementsWithIssues({
265
+ extendedElementsWithIssues,
266
+ scanContext,
267
+ violations: [violation1, violation2],
268
+ win,
269
+ name: 'accented',
270
+ });
240
271
  assert.equal(extendedElementsWithIssues.value.length, 2);
241
272
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
242
273
  assert.equal(extendedElementsWithIssues.value[0]?.issues.value.length, 1);
@@ -250,15 +281,22 @@ suite('updateElementsWithIssues', () => {
250
281
  id: 1,
251
282
  element: element1,
252
283
  rootNode,
284
+ skipRender: false,
253
285
  position,
254
286
  visible,
255
287
  trigger,
256
288
  anchorNameValue: 'none',
257
289
  scrollableAncestors,
258
- issues: signal([issue1])
259
- }
290
+ issues: signal([issue1]),
291
+ },
260
292
  ]);
261
- updateElementsWithIssues(extendedElementsWithIssues, [violation1, violation2], win, 'accented');
293
+ updateElementsWithIssues({
294
+ extendedElementsWithIssues,
295
+ scanContext,
296
+ violations: [violation1, violation2],
297
+ win,
298
+ name: 'accented',
299
+ });
262
300
  assert.equal(extendedElementsWithIssues.value.length, 2);
263
301
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
264
302
  assert.equal(extendedElementsWithIssues.value[0]?.issues.value.length, 1);
@@ -272,15 +310,22 @@ suite('updateElementsWithIssues', () => {
272
310
  id: 1,
273
311
  element: element1,
274
312
  rootNode,
313
+ skipRender: false,
275
314
  position,
276
315
  visible,
277
316
  trigger,
278
317
  anchorNameValue: 'none',
279
318
  scrollableAncestors,
280
- issues: signal([issue1])
281
- }
319
+ issues: signal([issue1]),
320
+ },
282
321
  ]);
283
- updateElementsWithIssues(extendedElementsWithIssues, [violation1, violation4], win, 'accented');
322
+ updateElementsWithIssues({
323
+ extendedElementsWithIssues,
324
+ scanContext,
325
+ violations: [violation1, violation4],
326
+ win,
327
+ name: 'accented',
328
+ });
284
329
  assert.equal(extendedElementsWithIssues.value.length, 1);
285
330
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
286
331
  });
@@ -291,26 +336,34 @@ suite('updateElementsWithIssues', () => {
291
336
  id: 1,
292
337
  element: element1,
293
338
  rootNode,
339
+ skipRender: false,
294
340
  position,
295
341
  visible,
296
342
  trigger,
297
343
  anchorNameValue: 'none',
298
344
  scrollableAncestors,
299
- issues: signal([issue1])
345
+ issues: signal([issue1]),
300
346
  },
301
347
  {
302
348
  id: 2,
303
349
  element: element2,
304
350
  rootNode,
351
+ skipRender: false,
305
352
  position,
306
353
  visible,
307
354
  trigger,
308
355
  anchorNameValue: 'none',
309
356
  scrollableAncestors,
310
- issues: signal([issue2])
311
- }
357
+ issues: signal([issue2]),
358
+ },
312
359
  ]);
313
- updateElementsWithIssues(extendedElementsWithIssues, [violation1], win, 'accented');
360
+ updateElementsWithIssues({
361
+ extendedElementsWithIssues,
362
+ scanContext,
363
+ violations: [violation1],
364
+ win,
365
+ name: 'accented',
366
+ });
314
367
  assert.equal(extendedElementsWithIssues.value.length, 1);
315
368
  assert.equal(extendedElementsWithIssues.value[0]?.element, element1);
316
369
  assert.equal(extendedElementsWithIssues.value[0]?.issues.value.length, 1);