Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper function to eliminate need for t.plan() #1312

Closed
spectranaut opened this issue Jan 27, 2020 · 0 comments · Fixed by #1343
Closed

Helper function to eliminate need for t.plan() #1312

spectranaut opened this issue Jan 27, 2020 · 0 comments · Fixed by #1343
Assignees
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo

Comments

@spectranaut
Copy link
Contributor

See this comment for background: https://github.com/w3c/aria-practices/pull/1120/files#r334756143

In summary, t.plan() is annoying to maintain but helps prevent false positives during loops, Sarah suggested:

we create a helper to get elements that also has an assertion that the returned elements array is not empty.

It would have two benefits: we don't need to worry about people forgetting to add t.plan(), and we also aren't testing the number of elements that exist in the DOM, as long as there's at least one. So, as an example, if we end up updating the tabs example to have one more tab, we don't then need to go update a bunch of t.plan()s in the tests.

@mcking65 mcking65 added enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo labels Jan 28, 2020
mcking65 added a commit that referenced this issue May 5, 2020
…ression tests (pull #1343)

Resolves issue #1312 with changes that:
* add queryElements helper
* update findElements to queryElements in tests, remove unused imports
* update missing awaits
* Add a lint check for findElements and exclude current uses
* Document `t` argument, unconditionally return `result`
* add assertNoElements test helper
* removed unnecessary eslit no-restricted-props
* update carousel tests to use queryElements

Co-authored-by: Simon Pieters <zcorpan@gmail.com>
Co-authored-by: Matt King <a11yThinker@Gmail.com>
michael-n-cooper pushed a commit that referenced this issue May 5, 2020
Infrastructure: Add queryElements test helper, remove t.plan from regression tests (pull #1343)

Resolves issue #1312 with changes that:
* add queryElements helper
* update findElements to queryElements in tests, remove unused imports
* update missing awaits
* Add a lint check for findElements and exclude current uses
* Document `t` argument, unconditionally return `result`
* add assertNoElements test helper
* removed unnecessary eslit no-restricted-props
* update carousel tests to use queryElements

Co-authored-by: Simon Pieters <zcorpan@gmail.com>
Co-authored-by: Matt King <a11yThinker@Gmail.com>
smhigley added a commit that referenced this issue May 20, 2020
…ression tests (pull #1343)

Resolves issue #1312 with changes that:
* add queryElements helper
* update findElements to queryElements in tests, remove unused imports
* update missing awaits
* Add a lint check for findElements and exclude current uses
* Document `t` argument, unconditionally return `result`
* add assertNoElements test helper
* removed unnecessary eslit no-restricted-props
* update carousel tests to use queryElements

Co-authored-by: Simon Pieters <zcorpan@gmail.com>
Co-authored-by: Matt King <a11yThinker@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy regression-testing Related to AVA regression tests of example pages or AVA framework implementation within repo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants