dequelabs / axe-core-gems

Ruby integration for axe-core, the accessibility testing engine
https://deque.com/axe
Mozilla Public License 2.0
86 stars 29 forks source link

`according_to` parameter should throw warning/error for unknown rule #77

Closed RaymondFallon closed 4 years ago

RaymondFallon commented 5 years ago

When writing an RSpec Test with axe-matchers, the according_to parameter should throw an error or print a warning if an unknown ruleset is passed.

I believe this would be helpful to prevent false positive tests that are a result of a typo. For example if a user tests:

expect(page).to be_accessible.according_to(:best-practices)

this expectation will pass 100% of the time, no matter how inaccessible the page is. The user is never warned that best-practices is not a valid ruleset (the correct name is best-practice, singular).

jeeyyy commented 5 years ago

@RaymondFallon thanks for reporting this. Let me evaluate on a fix for the same & get back to you.

RaymondFallon commented 5 years ago

Sounds good, thanks!

RaymondFallon commented 4 years ago

In a separate but very related issue, I wonder if there would be any support for the idea of aliasing best-practices to best-practice. To me, the plural version makes more sense as a ruleset, since it contains multiple "practices."

jeeyyy commented 4 years ago

@RaymondFallon

Apologies for the late turnaround, we have now re-engineered our packages/ gems quite a bit. Please refer to documentation for all the new changes.

As for your question on whether according_to clause should through an error if given a wrong 'tag', we intentionally do not want to do this. The thinking being future proofing, in that we continuously add and or improve the axe-core rules, and we may add some tags as placeholder for say new changes to WCAG spec etc., but not necessarily have a rule associated for that tag specifically, therefore failing for a wrong tag is something we cannot accommodate. I am positive that the results object will detail which rules if any were executed if given the wrong tag, which you could use for your assertions.

As for the question 'best-practice' is the tag we have currently.

Hope that helps.

Note: I will close this issue given the above explanation, feel free to open it if you want further resolution.