Skip to content

Generate testcase files #4

@WilcoFiers

Description

@WilcoFiers

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions