Skip to content

test: add static markup gate for ids, ARIA idrefs, img alt and script data-* hooks - #84

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-page-markup-gate
Oct 4, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-page-markup-gate

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/page-markup.test.mjs, a zero-dependency static gate over every committed non-redirect HTML page (index.html, stories/index.html). For each page it asserts:

  • ids are unique (and non-empty)
  • every ARIA idref (aria-controls, aria-labelledby, aria-describedby, aria-owns, aria-activedescendant) and label for resolves to an id on the same page — ids that appear only inside script text do not count
  • every img has an alt attribute
  • the root html element declares lang
  • every role="tab" has aria-controls and every role="tabpanel" has aria-labelledby
  • every [data-*] selector a page's inline script querySelectors exists in the page's markup (CSS and script text do not count), so a dropped attribute can no longer make a carousel silently return early

Each rule has fixture self-tests proving it both passes clean markup and fires on bad markup (10 fixture tests + 13 live-page tests + 1 hook sanity test). Mutation-checked against the real page: renaming one aria-controls target and one data-car-track attribute each produce a single failing test naming the line/hook.

The CI test job already runs node --test scripts/*.test.mjs, so the new file is picked up with no workflow change. README "Checks" section updated.

Verified locally: node --test scripts/*.test.mjs → 140 pass, 0 fail; scripts/check-links.sh → 0 internal errors.

Closes #83


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

… data-* hooks

Adds scripts/page-markup.test.mjs, a zero-dependency gate over every
committed non-redirect HTML page: ids are unique, ARIA idrefs and
label[for] resolve, every img has alt, the root html element declares
lang, role=tab/tabpanel carry their ARIA pair, and every [data-*]
selector an inline script queries exists in the markup. Each rule has a
fixture self-test. Picked up by the existing scripts/*.test.mjs glob in
the links workflow test job; no workflow change.

Closes #83

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive
hivecommons-hive Bot merged commit d34992f into main Oct 4, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-page-markup-gate branch October 4, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] No static gate for HTML markup invariants (unique ids, ARIA idrefs, img alt, script data-* hooks)

0 participants