Skip to content

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

Open
cycsmail wants to merge 1 commit into
dequelabs:developfrom
cycsmail:nodelist-context-docs-tests
Open

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

Conversation

@cycsmail

Copy link
Copy Markdown

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
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
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.

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