diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/dpub-aria | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dpub-aria')
-rw-r--r-- | testing/web-platform/tests/dpub-aria/.editorconfig | 10 | ||||
-rw-r--r-- | testing/web-platform/tests/dpub-aria/META.yml | 3 | ||||
-rw-r--r-- | testing/web-platform/tests/dpub-aria/README.md | 64 | ||||
-rw-r--r-- | testing/web-platform/tests/dpub-aria/inuse-manual.html | 141 |
4 files changed, 218 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dpub-aria/.editorconfig b/testing/web-platform/tests/dpub-aria/.editorconfig new file mode 100644 index 0000000000..842ce7b6bf --- /dev/null +++ b/testing/web-platform/tests/dpub-aria/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + diff --git a/testing/web-platform/tests/dpub-aria/META.yml b/testing/web-platform/tests/dpub-aria/META.yml new file mode 100644 index 0000000000..c6e339af63 --- /dev/null +++ b/testing/web-platform/tests/dpub-aria/META.yml @@ -0,0 +1,3 @@ +spec: https://w3c.github.io/dpub-aria/ +suggested_reviewers: + - halindrome diff --git a/testing/web-platform/tests/dpub-aria/README.md b/testing/web-platform/tests/dpub-aria/README.md new file mode 100644 index 0000000000..cf76613c6b --- /dev/null +++ b/testing/web-platform/tests/dpub-aria/README.md @@ -0,0 +1,64 @@ +dpub-aria: Tests for the DPUB-ARIA Recommendations +================================================== + +The [DPUB ARIA Recommendation](https://www.w3.org/TR/dpub-aria-1.0) +define extensions to HTML4/5 for support of extended semantics. These +semantics make it easier for Assistive Technologies to interpret and +present content to users with varying physical and cognitive abilities. + +The purpose of these tests is to help ensure that user agents support the +requirements of the Recommendation. + +The general approach for this testing is to enable both manual and automated +testing, with a preference for automation. + + +Running Tests +------------- + +In order to run these tests in an automated fashion, you will need to have a +special Assistive Technology Test Adapter (ATTA) for the platform under test. We will +provide a list of these for popular platforms here as they are made available. + +The ATTA will monitor the window under test via the platforms Accessibility +Layer, forwarding information about the Accessibility Tree to the running test +so that it can evaluate support for the various features under test. + +The workflow for running these tests is something like: + +1. Start up the ATTA for the platform under test. +2. Start up the test driver window and select the dpub -aria tests to be run + (e.g., the DPUB ARIA 1.0 tests) - click "Start" +3. A window pops up that shows a test - the description of which tells the + tester what is being tested. In an automated test, the test with proceed + without user intervention. In a manual test, some user input may be required + in order to stimulate the test. +4. The test runs. Success or failure is determined and reported to the test + driver window, which then cycles to the next test in the sequence. +5. Repeat steps 2-4 until done. +6. Download the JSON format report of test results, which can then be visually + inspected, reported on using various tools, or passed on to W3C for + evaluation and collection in the Implementation Report via github. + +**Remember that while these tests are written to help exercise implementations, +their other (important) purpose is to increase confidence that there are +interoperable implementations.** So, implementers are the audience, but these +tests are not meant to be a comprehensive collection of tests for a client that +might implement the Recommendation. + + +Capturing and Reporting Results +------------------------------- + +As tests are run against implementations, if the results of testing are +submitted to [test-results](https://github.com/w3c/test-results/) then they will +be automatically included in documents generated by +[wptreport](https://www.github.com/w3c/wptreport). The same tool can be used +locally to view reports about recorded results. + + +Writing Tests +------------- + +If you are interested in writing tests for this environment, see the +associated [CONTRIBUTING](CONTRIBUTING.md) document. diff --git a/testing/web-platform/tests/dpub-aria/inuse-manual.html b/testing/web-platform/tests/dpub-aria/inuse-manual.html new file mode 100644 index 0000000000..cd6af1e735 --- /dev/null +++ b/testing/web-platform/tests/dpub-aria/inuse-manual.html @@ -0,0 +1,141 @@ +<!doctype html> +<html> +<head> + <title>Check for Dpub Vocabulary Role Usage</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +setup({explicit_timeout: true, explicit_done: true }); + +var theRoles = [ + "doc-abstract", + "doc-acknowledgments", + "doc-afterword", + "doc-appendix", + "doc-backlink", + "doc-biblioentry", + "doc-bibliography", + "doc-biblioref", + "doc-chapter", + "doc-colophon", + "doc-conclusion", + "doc-cover", + "doc-credit", + "doc-credits", + "doc-dedication", + "doc-endnote", + "doc-endnotes", + "doc-epigraph", + "doc-epilogue", + "doc-errata", + "doc-example", + "doc-footnote", + "doc-foreword", + "doc-glossary", + "doc-glossref", + "doc-index", + "doc-introduction", + "doc-noteref", + "doc-notice", + "doc-pagebreak", + "doc-pagelist", + "doc-part", + "doc-preface", + "doc-prologue", + "doc-pullquote", + "doc-qna", + "doc-subtitle", + "doc-tip", + "doc-toc" + ]; + + /* runTests - run tests against the content + * + * @param content - a string with the content to test + */ + function runTests(content) { + 'use strict'; + // keep track of the test number executed + var testCounter = 1; + // create a DOM tree for the content + var theDOM = document.createElement("body"); + + // check the content - if it has a body element, strip up to it and after the + // close + + content = content.replace(/\n/g, " "); + + if (content.search(/<body/i) !== -1) { + // there is an opening body tag + content = content.replace(/^.*<body[^>]*>/i, ''); + if (content.search(/<\/[^>]*body/i) !== -1) { + content = content.replace(/<\/[^>]*body.*$/i, ''); + } + } + + var parseFail = false ; + var parseMessage = "" ; + + if ("" === content || content.search(/^ +$/) !== -1 ) { + // there is NO content + parseFail = true; + parseMessage = "Content is empty"; + } else { + try { + // add the content into the created body element + theDOM.innerHTML = content; + } + catch(err) { + parseFail = true; + parseMessage = err; + } + } + + test(function() { + assert_false(parseFail, parseMessage); + }, testCounter + " Can parse submitted content"); + + testCounter += 1; + + // loop over the tree looking for roles with the values in theRoles + + theRoles.forEach(function(role) { + var tName = testCounter + " " + "Uses role " + role; + testCounter += 1; + var nodes = theDOM.querySelectorAll('[role~="'+role+'"]'); + if (nodes.length) { + // there are matching nodes + test(function() { + assert_true(true, "Found the role"); + }, tName); + } + }); + + done(); + }; + +on_event(document, "DOMContentLoaded", function() { + var runButton = document.getElementById('dpub-run') ; + var closeButton = document.getElementById('dpub-close') ; + + on_event(runButton, "click", function() { + var content = document.getElementById("dpub-input"); + + runTests(content.value); + }); +}); +</script> +</head> +<body> + <p>Fill the textarea below with the contents of a <code>body</code> element + from HTML markup from that reflects your usage of + DPub-ARIA roles. Then select "Run Test" to evaluate the content.</p> + <form name="dpub" id="dpub"> + <textarea name="dpub-input" id="dpub-input" style="width: 90%; height: 10em" ></textarea> + <p><input type="button" id="dpub-run" name="Run Test" value="Run Test"> + <input style="display: none" type="button" id="dpub-close" + name="Close" value="Close"></p> + </form> + <div id="log"></div> +</body> +</html> |