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

feat(checks): normalize check options to alway be an object #2219

Merged
merged 5 commits into from
May 12, 2020

Conversation

straker
Copy link
Contributor

@straker straker commented May 7, 2020

Ensured check options is always an object and normalized any non-objects to be { value: param }. Also ensured each check was passed a merged result of the check default options and any passed in options so that you didn't need to pass all options in just to override one of them.

Created a testUtils helper utility that also merges the options and calls the evaluate method. This will also allow us to not have to pass in default check options for tests in #2216 and #2215 (simplifying those greatly). Since the evaluate methods are never called directly but instead through check.run, having a wrapper to call that does the options merging is actually more closely tied to how we call the API.

I also updated all check tests to use the new function (simple find and replace).

The important files (not find/replaced):

  • all /lib files
  • all test/core and test/public files
  • test/testutils.js
  • test/checks/aria/aria-valid-attr-evaluate.js
  • test/checks/aria/aria-valid-attr-value-evaluate.js
  • test/checks/language/valid-lang-evaluate.js
  • test/checks/shared/non-empty-alt.js
  • test/checks/shared/non-empty-value.js
  • test/checks/shared/non-empty-title.js

Closes issue: #2191

Reviewer checks

Required fields, to be filled out by PR reviewer(s)

  • Follows the commit message policy, appropriate for next version
  • Code is reviewed for security

@straker straker requested a review from a team as a code owner May 7, 2020 17:42
Copy link
Contributor

@WilcoFiers WilcoFiers left a comment

Choose a reason for hiding this comment

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

minor stuff

lib/core/base/check.js Show resolved Hide resolved
lib/core/base/check.js Outdated Show resolved Hide resolved
straker and others added 2 commits May 12, 2020 08:11
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
@straker straker merged commit da12da7 into develop May 12, 2020
@straker straker deleted the check-options branch May 12, 2020 15:08
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.

2 participants