Last active
August 29, 2015 13:56
-
-
Save kevee/9145529 to your computer and use it in GitHub Desktop.
Sample test file for scriptFocusIndicatorVisible
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>scriptFocusIndicatorVisible</title> | |
| <style> | |
| #test-1 .has-focus { | |
| border: 3px solid green; | |
| } | |
| #test-2 a, #test-1 input { | |
| background: red; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="quail-test" data-expected="pass" data-accessibility-test="scriptFocusIndicatorVisible" id="test-1"> | |
| <a href="somewhere">This link is highly visible when it gets focus</a> | |
| <form> | |
| <label for="input">An input element with a highly-visible focus</label> | |
| <input type="text" id="input"></form> | |
| <script> | |
| (function($) { | |
| var focusableElms = $('#test-1 a,#test-1 input'); | |
| var setFocusIndicator = function() { | |
| $(this).addClass('has-focus'); | |
| }; | |
| var resetFocusIndicator = function() { | |
| $(this).removeClass('has-focus'); | |
| }; | |
| focusableElms.on('focus', setFocusIndicator); | |
| focusableElms.on('blur', resetFocusIndicator); | |
| })(jQuery); | |
| </script> | |
| </div> | |
| <div class="quail-test" data-expected="fail" data-accessibility-test="scriptFocusIndicatorVisible" id="test-2"> | |
| <a href="somewhere" class="quail-failed-element">Not really much of a difference when you focus this link.</a> | |
| <form> | |
| <label for="input-2">An input element with a bad focus</label> | |
| <input type="text" id="input-2" class="quail-failed-element"></form> | |
| </div> | |
| <script src="../testrunner.js"></script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment