Created
October 21, 2013 02:10
-
-
Save parente/7077713 to your computer and use it in GitHub Desktop.
Accerciser example rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CheckFocusable(Validator): | |
| def condition(self, acc): | |
| # only test accessibles that have the action interface | |
| return acc.queryAction() | |
| def after(self, acc, state, view): | |
| # check an accessible after checking its descendants | |
| # acc is the accessible | |
| # state is a dictionary of whatever you need to store across tests | |
| # view logs errors, warnings, etc. | |
| pass | |
| def before(self, acc, state, view): | |
| # check an accessible before checking its descendants | |
| s = acc.getState() | |
| if not s.contains(STATE_FOCUSABLE): | |
| view.error('actionable widget is not focusable') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment