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

Reporter: fix several WCAG violations #1528

Merged
merged 4 commits into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions reporter/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ export function escapeText( s ) {
}

function appendInterface() {
var qunit = id( "qunit" );
const qunit = id( "qunit" );
smcclure15 marked this conversation as resolved.
Show resolved Hide resolved

// For compat with QUnit 1.2, and to support fully custom theme HTML,
// we will use any existing elements if no id="qunit" element exists.
Expand All @@ -611,12 +611,14 @@ export function escapeText( s ) {
// having the HTML reporter actively render anything.
if ( qunit ) {

qunit.setAttribute( "role", "main" );

// Since QUnit 1.3, these are created automatically if the page
// contains id="qunit".
qunit.innerHTML =
"<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
"<h2 id='qunit-banner'></h2>" +
"<div id='qunit-testrunner-toolbar'></div>" +
"<div id='qunit-banner'></div>" +
smcclure15 marked this conversation as resolved.
Show resolved Hide resolved
"<div id='qunit-testrunner-toolbar' role='navigation'></div>" +
appendFilteredTest() +
"<h2 id='qunit-userAgent'></h2>" +
"<ol id='qunit-tests'></ol>";
Expand Down
1 change: 1 addition & 0 deletions runner/fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { window, document } from "../src/globals";

var fixture = document.getElementById( "qunit-fixture" );
if ( fixture ) {
fixture.setAttribute( "role", "region" );
smcclure15 marked this conversation as resolved.
Show resolved Hide resolved
config.fixture = fixture.cloneNode( true );
}
}
Expand Down
10 changes: 8 additions & 2 deletions test/main/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ QUnit.module( "test", function() {
QUnit.test( "automatically reset", function( assert ) {
assert.fixtureEquals( {
tagName: "div",
attributes: { id: "qunit-fixture" },
attributes: {
id: "qunit-fixture",
role: "region"
},
content: originalValue.innerHTML
} );
assert.equal( values.length, 5, "proper sequence" );
Expand All @@ -101,7 +104,10 @@ QUnit.module( "test", function() {
QUnit.test( "automatically reset after attribute value mutation", function( assert ) {
assert.fixtureEquals( {
tagName: "div",
attributes: { id: "qunit-fixture" },
attributes: {
id: "qunit-fixture",
role: "region"
},
content: originalValue.innerHTML
} );
assert.equal( values.length, 4, "proper sequence" );
Expand Down