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

Generate testcase files #4

Open
WilcoFiers opened this issue Jul 16, 2021 · 0 comments
Open

Generate testcase files #4

WilcoFiers opened this issue Jul 16, 2021 · 0 comments

Comments

@WilcoFiers
Copy link
Member

Right now test cases are created and placed into act-rules/act-rules.github.io#master. These test cases should instead be added to the WAI website. As part of the transform-rule script, we'll want to generate testcase files and put them into a directory like so: content/testcases/{ruleId}/{testcaseHash}.{extension}

There is already a script to create these files in act-rules/act-rules-web. We'll need to convert that to typescript. In addition, we'll want to make a few more changes:

  1. The hash should be an md5 hash, applied to the test case snippet, with sequences of ASCII-whitespace replaced with a single space character. This ensures changes in whitespace, which can happen when Prettier is updated, don't change hashes. Unlike is currently the case, rule ID and language (html, svg, xml) should not be included in the hash. Adding rule IDs creates problems with atomic/composite rules, and the language encoding is unnecessary since the file extension of the test case file avoids problems with those already

  2. When the test case is HTML, and it does not include a doctype or an html element, the test case is wrapped in a small template:

<!doctype html>
<html lang="en">
  <head>
    <title>{rule title}: {Passed|Failed|Inapplicable} Example {#}<title>
  </head>
  <body>
    {{code snippet here, properly formatted and indented }}
  </body>
</html>
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

No branches or pull requests

1 participant