Skip to content

Commit

Permalink
Added support for empty level values. (GSA#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmundra authored Jan 6, 2022
1 parent 4ba84f8 commit eb69352
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 9 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openacr/openacr",
"version": "0.3.0",
"version": "0.3.1",
"description": "OpenACR schema validator and output generator",
"repository": "GSA/openacr",
"license": "CC0-1.0",
Expand Down
1 change: 1 addition & 0 deletions src/validateOpenACRCatalogValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function validateOpenACRCatalogValues(
if (catalog.terms) {
if (dataComponent.adherence) {
if (
dataComponent.adherence.level &&
!checkForCatalogTermDefinition(
dataComponent.adherence.level,
catalog.terms
Expand Down
27 changes: 27 additions & 0 deletions tests/examples/valid-components-adherence-level-none.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
title: Lorem Ipsum Accessibility Conformance Report
product:
name: Lorem Ipsum
version: "1.1"
description: Fake text
author:
email: [email protected]
chapters:
success_criteria_level_a:
criteria:
- num: "1.1.1"
components:
- name: "web"
adherence:
level: "supports"
notes: Cras ultrices, diam in laoreet condimentum, purus leo tempor erat, eu facilisis erat tortor at purus.
- name: "electronic-docs"
adherence:
level: "supports"
notes: Curabitur tristique tellus quis ligula elementum, sit amet tincidunt est aliquet.
- num: "1.2.2"
components:
- name: "web"
adherence:
level: ""
hardware:
notes: "Lorem Ipsum is a web application. Hardware accessibility criteria is not applicable."
22 changes: 22 additions & 0 deletions tests/openacr-validate-cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,28 @@ describe("OpenACR CLI test validation", () => {
});
});

it("when passed a file that has components with adherence level set to none should return valid message", () => {
const invalid = spawn(
cmd,
options.concat(
"tests/examples/valid-components-adherence-level-none.yaml",
"-c",
"catalog/2.4-edition-wcag-2.0-508-en.yaml"
)
);
const chunks = [];

invalid.stdout.on("data", (chunk) => {
chunks.push(chunk);
});

invalid.stdout.on("end", () => {
const output = Buffer.concat(chunks).toString();

expect(output).to.equal("Valid!\n");
});
});

it("when passed a YAML catalog file with components that have no definitions should return invalid message", () => {
const invalid = spawn(
cmd,
Expand Down

0 comments on commit eb69352

Please sign in to comment.