Skip to content

test(context): cover NodeList for include/exclude and fix doc examples - #5178

Merged
straker merged 1 commit into
dequelabs:developfrom
cycsmail:nodelist-context-docs-tests
Jul 14, 2026
Merged

test(context): cover NodeList for include/exclude and fix doc examples#5178
straker merged 1 commit into
dequelabs:developfrom
cycsmail:nodelist-context-docs-tests

Conversation

@cycsmail

Copy link
Copy Markdown
Contributor

The context.md examples labeled "Test a Node list" and "Test everything except these DOM nodes" used document.querySelector(...), which only ever returns a single node, so they didn't actually show a NodeList. Switched both to document.querySelectorAll(...) and tweaked the comments so the examples demonstrate the NodeList support that already works. Also added two Context unit tests: one for a NodeList passed as the bare context, and one for NodeLists passed via include/exclude. (doc/API.md already lists NodeList as an accepted context, so it didn't need a change.)

Heads up: I couldn't get the browser test runner going in my environment, so the new assertions were checked against the built axe.js bundle under jsdom rather than web-test-runner — prettier and eslint are clean. Worth a CI run to confirm in-browser.

Closes: #3348

@cycsmail
cycsmail requested a review from a team as a code owner June 17, 2026 15:35
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@straker

straker commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I couldn't get the browser test runner going in my environment, so the new assertions were checked against the built axe.js bundle under jsdom rather than web-test-runner — prettier and eslint are clean

Interesting. What environment are you running where that didn't work? We just switched over to web test runner so I'd like to make sure it's usable for anyone who wants to work in axe-core.

@cycsmail

Copy link
Copy Markdown
Contributor Author

Chrome-for-Testing downloaded fine but the browser wouldn't launch in my container — needed --no-sandbox and was missing the usual system libs (libnss3, libgbm, libasound2…). So I ran the same assertions through the jsdom path against the built axe.js instead. The two tests are in the normal browser suite though, so they'll run fine in your CI.

If you want it smoother for container/CI folks, passing --no-sandbox --disable-dev-shm-usage in the launcher + a note on the apt deps would cover most headless setups.

@cycsmail

Copy link
Copy Markdown
Contributor Author

Update — sorted the browser in my container (system libs + --no-sandbox) and ran the full web-test-runner suite this time. Both new NodeList tests pass in real Chromium, whole suite green (8,304 across 124 files) — holds up in-browser, not just the jsdom check.

@straker straker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pr! Apologies for it taking some time to get in.

Approved for security

@straker
straker merged commit 95b68fa into dequelabs:develop Jul 14, 2026
22 of 23 checks passed
@cycsmail

Copy link
Copy Markdown
Contributor Author

no worries at all, thanks for getting it in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update docs and tests to add NodeList support to include/exclude

3 participants