@setsquare/review-sdk 0.0.1 → 0.1.1

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 (116) hide show
  1. package/NOTICE +3 -2
  2. package/README.md +287 -3
  3. package/dist/autoscan.d.ts +23 -1
  4. package/dist/autoscan.d.ts.map +1 -1
  5. package/dist/autoscan.js +220 -15
  6. package/dist/autoscan.js.map +1 -1
  7. package/dist/brand.d.ts +51 -2
  8. package/dist/brand.d.ts.map +1 -1
  9. package/dist/brand.js +560 -5
  10. package/dist/brand.js.map +1 -1
  11. package/dist/checks/context-change.d.ts +96 -0
  12. package/dist/checks/context-change.d.ts.map +1 -0
  13. package/dist/checks/context-change.js +655 -0
  14. package/dist/checks/context-change.js.map +1 -0
  15. package/dist/checks/focus.d.ts +154 -0
  16. package/dist/checks/focus.d.ts.map +1 -0
  17. package/dist/checks/focus.js +1123 -0
  18. package/dist/checks/focus.js.map +1 -0
  19. package/dist/checks/heuristics.d.ts +117 -0
  20. package/dist/checks/heuristics.d.ts.map +1 -0
  21. package/dist/checks/heuristics.js +961 -0
  22. package/dist/checks/heuristics.js.map +1 -0
  23. package/dist/checks/keyboard.d.ts +106 -0
  24. package/dist/checks/keyboard.d.ts.map +1 -0
  25. package/dist/checks/keyboard.js +452 -0
  26. package/dist/checks/keyboard.js.map +1 -0
  27. package/dist/checks/reflow.d.ts +75 -0
  28. package/dist/checks/reflow.d.ts.map +1 -0
  29. package/dist/checks/reflow.js +285 -0
  30. package/dist/checks/reflow.js.map +1 -0
  31. package/dist/checks/rule-pack.d.ts +1 -1
  32. package/dist/checks/rule-pack.d.ts.map +1 -1
  33. package/dist/checks/rule-pack.js +350 -45
  34. package/dist/checks/rule-pack.js.map +1 -1
  35. package/dist/checks/shortcuts.d.ts +71 -0
  36. package/dist/checks/shortcuts.d.ts.map +1 -0
  37. package/dist/checks/shortcuts.js +196 -0
  38. package/dist/checks/shortcuts.js.map +1 -0
  39. package/dist/checks/versions.d.ts.map +1 -1
  40. package/dist/checks/versions.js +33 -1
  41. package/dist/checks/versions.js.map +1 -1
  42. package/dist/contract.d.ts +32 -0
  43. package/dist/contract.d.ts.map +1 -1
  44. package/dist/covers.d.ts +56 -0
  45. package/dist/covers.d.ts.map +1 -0
  46. package/dist/covers.js +135 -0
  47. package/dist/covers.js.map +1 -0
  48. package/dist/dedupe.d.ts +23 -0
  49. package/dist/dedupe.d.ts.map +1 -1
  50. package/dist/dedupe.js +96 -2
  51. package/dist/dedupe.js.map +1 -1
  52. package/dist/document.d.ts.map +1 -1
  53. package/dist/document.js +144 -0
  54. package/dist/document.js.map +1 -1
  55. package/dist/envelope.d.ts +8 -0
  56. package/dist/envelope.d.ts.map +1 -1
  57. package/dist/envelope.js +106 -16
  58. package/dist/envelope.js.map +1 -1
  59. package/dist/fixture.d.ts.map +1 -1
  60. package/dist/fixture.js +33 -4
  61. package/dist/fixture.js.map +1 -1
  62. package/dist/html-report.d.ts +24 -7
  63. package/dist/html-report.d.ts.map +1 -1
  64. package/dist/html-report.js +608 -136
  65. package/dist/html-report.js.map +1 -1
  66. package/dist/index.d.ts +13 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +13 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/insights.d.ts.map +1 -1
  71. package/dist/insights.js +9 -12
  72. package/dist/insights.js.map +1 -1
  73. package/dist/links.d.ts +43 -0
  74. package/dist/links.d.ts.map +1 -1
  75. package/dist/links.js +43 -0
  76. package/dist/links.js.map +1 -1
  77. package/dist/observe.d.ts +8 -0
  78. package/dist/observe.d.ts.map +1 -1
  79. package/dist/observe.js +45 -1
  80. package/dist/observe.js.map +1 -1
  81. package/dist/options.d.ts +53 -0
  82. package/dist/options.d.ts.map +1 -1
  83. package/dist/options.js +3 -0
  84. package/dist/options.js.map +1 -1
  85. package/dist/reading-level.d.ts +22 -1
  86. package/dist/reading-level.d.ts.map +1 -1
  87. package/dist/reading-level.js +122 -19
  88. package/dist/reading-level.js.map +1 -1
  89. package/dist/reporter.d.ts.map +1 -1
  90. package/dist/reporter.js +31 -15
  91. package/dist/reporter.js.map +1 -1
  92. package/dist/scan.d.ts +36 -1
  93. package/dist/scan.d.ts.map +1 -1
  94. package/dist/scan.js +16 -2
  95. package/dist/scan.js.map +1 -1
  96. package/dist/screens.d.ts +55 -4
  97. package/dist/screens.d.ts.map +1 -1
  98. package/dist/screens.js +243 -43
  99. package/dist/screens.js.map +1 -1
  100. package/dist/settle.d.ts +35 -0
  101. package/dist/settle.d.ts.map +1 -1
  102. package/dist/settle.js +43 -2
  103. package/dist/settle.js.map +1 -1
  104. package/dist/summary.d.ts +35 -0
  105. package/dist/summary.d.ts.map +1 -1
  106. package/dist/summary.js +248 -28
  107. package/dist/summary.js.map +1 -1
  108. package/dist/unscannable-reasons.d.ts +30 -0
  109. package/dist/unscannable-reasons.d.ts.map +1 -0
  110. package/dist/unscannable-reasons.js +53 -0
  111. package/dist/unscannable-reasons.js.map +1 -0
  112. package/dist/viewports.d.ts +105 -0
  113. package/dist/viewports.d.ts.map +1 -0
  114. package/dist/viewports.js +134 -0
  115. package/dist/viewports.js.map +1 -0
  116. package/package.json +5 -4
@@ -0,0 +1,96 @@
1
+ import type { Page } from '@playwright/test';
2
+ import type { DynamicCheckEvidence } from './dynamic.js';
3
+ /**
4
+ * WCAG 3.2.1 On Focus (A) and 3.2.2 On Input (A): does touching a control
5
+ * change the context without being asked to?
6
+ *
7
+ * "Change of context" is normatively defined — user agent, viewport, focus, or
8
+ * content that changes the meaning of the page — and the first three are
9
+ * observable. The fourth is a judgement, so a large DOM mutation is
10
+ * needs-review rather than a violation.
11
+ *
12
+ * ---------------------------------------------------------------------------
13
+ * **The two halves have very different side effects, so they are gated
14
+ * differently. That is the decision this check exists around.**
15
+ *
16
+ * **3.2.1 is on by default.** It needs nothing the teardown focus walk does not
17
+ * already do — focusing every focusable element — so it adds no new class of
18
+ * side effect to a run that is already focusing them.
19
+ *
20
+ * **3.2.2 is opt-in, off by default** (`onInput: true`). It has to CHANGE a
21
+ * control's value, and a change event is where an application saves. A
22
+ * customer's page at teardown can be an authenticated application whose select
23
+ * has an autosave handler behind it, and mutating their data is a worse failure
24
+ * than any finding this rule could produce — worse, in particular, than being a
25
+ * flake, because a flake is visible and a silent write is not. So it is a
26
+ * choice somebody makes, and while it is off the criterion reports as "a check
27
+ * that did not run here", which is exactly what it is.
28
+ *
29
+ * **Text fields are never typed into, at any setting.** Only `<select>`,
30
+ * checkboxes and radios are touched, and their value is put back. Typing into a
31
+ * text field is a different risk class again: validation requests, autosave,
32
+ * character counters, and a half-filled form left behind.
33
+ * ---------------------------------------------------------------------------
34
+ */
35
+ export declare const SETSQUARE_CONTEXT_CHECK_VERSION = "setsquare-context@1";
36
+ export declare const ON_FOCUS_RULE_ID = "setsquare-on-focus";
37
+ export declare const ON_INPUT_RULE_ID = "setsquare-on-input";
38
+ declare const MAX_CONTROLS = 40;
39
+ export interface ContextChangeRow {
40
+ selector: string;
41
+ /** What was observed: `focus-moved`, `window-opened`, `navigated`, `mutation`. */
42
+ kind: 'focus-moved' | 'window-opened' | 'navigated' | 'mutation';
43
+ /** Where focus went, or what was navigated to, when we could see it. */
44
+ detail?: string;
45
+ /** Nodes added or removed, for a `mutation` row. */
46
+ nodes?: number;
47
+ }
48
+ export interface ContextWalk {
49
+ /** Controls actually touched. Zero means nothing this criterion regulates. */
50
+ checked: number;
51
+ /** Candidates found, before the ceiling. */
52
+ found: number;
53
+ truncated: boolean;
54
+ changes: ContextChangeRow[];
55
+ }
56
+ /**
57
+ * Focus every focusable element and watch for an unrequested change of context.
58
+ *
59
+ * Runs entirely in the page, in one evaluate, because a round trip per element
60
+ * over a hundred and twenty of them at the end of every test is a cost nobody
61
+ * agreed to. That bounds what it can see, and the boundary is stated in the
62
+ * finding rather than papered over: `window.open` and `location.assign` /
63
+ * `location.replace` are patched and recorded, but `location.href = …` is a
64
+ * native setter on a non-configurable object and cannot be intercepted. A page
65
+ * that navigates that way on focus destroys the execution context, which
66
+ * surfaces as no evidence at all rather than as a pass.
67
+ */
68
+ export declare function runOnFocus(page: Page): Promise<DynamicCheckEvidence>;
69
+ /**
70
+ * Change each `<select>`, checkbox and radio, and watch for a change of
71
+ * context. Opt-in; see the decision at the top of this file.
72
+ *
73
+ * Driven from Node rather than from one evaluate, unlike 3.2.1, because the
74
+ * failure this exists to catch — a select whose handler does
75
+ * `location.href = this.value` — navigates through a native setter that cannot
76
+ * be patched from inside the page. Playwright can see the navigation request
77
+ * and abort it before it commits, which is both how we detect it and how we
78
+ * stop it destroying the run. There are rarely more than a handful of such
79
+ * controls on a page, so the round trips are affordable in a way a
80
+ * hundred-and-twenty-element focus walk is not.
81
+ *
82
+ * Three guards, in this order, and the first is the one that matters most:
83
+ *
84
+ * 1. **Nothing is ever submitted.** A capture-phase listener cancels every
85
+ * `submit` event and records that it happened — so an attempted submit is
86
+ * the finding AND the thing that did not occur. A submit triggered by our
87
+ * own input would be worse than any finding: it writes.
88
+ * 2. **No navigation commits.** Navigation requests are aborted at the route
89
+ * level. The attempt is what we report.
90
+ * 3. **Every value is put back**, in a `finally`, whatever happened.
91
+ */
92
+ export declare function runOnInput(page: Page): Promise<DynamicCheckEvidence>;
93
+ export declare function onFocusEvidence(walk: ContextWalk): DynamicCheckEvidence;
94
+ export declare function onInputEvidence(walk: ContextWalk): DynamicCheckEvidence;
95
+ export { MAX_CONTROLS };
96
+ //# sourceMappingURL=context-change.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-change.d.ts","sourceRoot":"","sources":["../../src/checks/context-change.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,gBAAgB,uB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