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

Add testcases structure #37

Merged
merged 2 commits into from Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion _config.yml
Expand Up @@ -17,8 +17,12 @@ kramdown:
collections:
rules:
output: true
rule-tests:
output: true
drafts:
output: true
draft-tests:
output: true

defaults:
- scope:
Expand All @@ -34,10 +38,22 @@ defaults:
path: ""
type: drafts
values:
layout: draft
layout: rule
draft: true
name: undefined
rule_id: undefined
test_mode: undefined
- scope:
path: ""
type: rule-tests
values:
layout: testcase
- scope:
path: ""
type: draft-tests
values:
layout: testcase
draft: true
- scope:
path: pages/algorithms
values:
Expand Down
60 changes: 60 additions & 0 deletions _data/criteria.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions _draft-tests/SC1-1-1-decorative-images.html
@@ -0,0 +1,26 @@
---
rule_id: SC1-1-1-decorative-images

success_criterion:
- 1.1.1 # Non-text Content (level A)
---

<h2>inapplicable</h2>

<p><strong>To do</strong></p>

<h2>step1-pass</h2>

<div data-outcome="passed"
data-outcome-id="step1-pass"
data-user-responses="[true]">
<img alt="" id="target">
</div>

<h2>step1-fail</h2>

<div data-outcome="failed"
data-outcome-id="step1-fail"
data-user-responses="[false]">
<img alt="" id="target">
</div>
18 changes: 14 additions & 4 deletions _layouts/default.html
Expand Up @@ -2,8 +2,18 @@
<html lang="en">
<head>
<meta charset="utf-8">

<title>{{ page.title | escape }} - {{ site.title | escape }}</title>
{% if page.rule_id and page.layout == 'rule' %}
{% assign page_title = page.rule_id | prepend: "Rule: " %}
{% else %}
{% if page.rule_id and page.layout == 'testcase' %}
{% assign page_title = page.rule_id | prepend: "Test Cases for " %}
{% else %}
{% assign page_title = page.title %}
{% endif %}
{% endif %}
<title>
{{ page_title }} - {{ site.title | escape }}
</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">

<link rel="stylesheet" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}">
Expand Down Expand Up @@ -94,8 +104,8 @@
</nav>

<main class="container">
{% if page.title %}
<h1>{{ page.title }}</h1>
{% if page_title %}
<h1>{{ page_title }}</h1>
{% endif %}

{{ content }}
Expand Down
7 changes: 0 additions & 7 deletions _layouts/draft.html

This file was deleted.

5 changes: 4 additions & 1 deletion _layouts/rule.html
@@ -1,8 +1,11 @@
---
layout: default
title: {{ page.rule_id }}
---

{% if page.draft %}
<p class="draft-note"><strong>Please note, this is a draft</strong></p>
{% endif %}

{% if page.date %}
<p>Late updated: <time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time></p>
{% endif %}
Expand Down
17 changes: 17 additions & 0 deletions _layouts/testcase.html
@@ -0,0 +1,17 @@
---
layout: default
---

<p>Back to rule:
<a href="{%
if page.draft != true
%}../rules/{{ page.rule_id }}.html{%
else
%}../drafts/{{ page.rule_id }}.html{%
endif
%}">{{ page.rule_id }}</a>
</p>

<p>Elements that match <code>[data-outcome="inapplicable"]</code> should be ignored by the rule. Elements that match <code>[data-outcome="failed"]</code> should be returned as failed, and those matching <code>[data-outcome="passed"]</code> should be passed. Other elements may match other rules, these results should be ignored for the purpose of this test file.</p>

{{ content }}
27 changes: 27 additions & 0 deletions act-testcases.json
@@ -0,0 +1,27 @@
---
layout: null
---
{
"name": "auto-wcag",
"license": "https://www.w3.org/community/about/agreements/cla/",
"a11y-selectors": {
"passedSelector": "*[data-outcome=\"passed\"]",
"failedSelector": "*[data-outcome=\"failed\"]",
"inapplicableSelector": "*[data-outcome=\"inapplicable\"]"
},
"a11y-testcases": [{% for testcase in site.rule-tests %}
{
"url": "https://auto-wcag.github.io/auto-wcag/rule-tests/{{
testcase.rule_id
}}.html",
"rule": "auto-wcag:{{ testcase.rule_id }}",
"successCriteria": [{%
for criterion in testcase.success_criterion
%}"{{ site.data.criteria[criterion].id }}"{%
unless forloop.last
%}, {%
endunless
%}{% endfor %}]
}{% unless forloop.last %},{% endunless %}
{% endfor %}]
}
34 changes: 0 additions & 34 deletions draft-tests/SC1-1-1-decorative-images.md

This file was deleted.