Skip to content

Commit

Permalink
refactor(core/issues-notes): fold in w3c/aria
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Oct 19, 2017
1 parent bd22447 commit 332f952
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 47 deletions.
1 change: 0 additions & 1 deletion js/profile-w3c-common.js
Expand Up @@ -65,7 +65,6 @@ define(
"w3c/permalinks",
"core/id-headers",
"core/rdfa",
"w3c/aria",
"core/location-hash",
"ui/about-respec",
"ui/dfn-list",
Expand Down
6 changes: 4 additions & 2 deletions src/core/issues-notes.js
Expand Up @@ -10,7 +10,6 @@
// numbered to avoid involuntary clashes.
// If the configuration has issueBase set to a non-empty string, and issues are
// manually numbered, a link to the issue is created using issueBase and the issue number

import { pub } from "core/pubsubhub";
import css from "deps/text!core/css/issues-notes.css";
import { fetch as ghFetch, fetchIndex } from "core/github";
Expand Down Expand Up @@ -54,14 +53,15 @@ export function run(conf, doc, cb) {
"'></div>"
),
$tit = $(
"<div class='" + report.type + "-title'><span></span></div>"
"<div role='heading' class='" + report.type + "-title'><span></span></div>"
),
text = isIssue
? isFeatureAtRisk ? "Feature at Risk" : conf.l10n.issue
: isWarning
? conf.l10n.warning
: isEdNote ? conf.l10n.editors_note : conf.l10n.note,
ghIssue;
$tit.makeID("h", report.type);
report.title = $inno.attr("title");
if (isIssue) {
if (hasDataNum) {
Expand Down Expand Up @@ -123,6 +123,8 @@ export function run(conf, doc, cb) {
body = ghIssue.body_html;
}
$div.append(body);
const level = $tit.parents("section").length + 2;
$tit.attr("aria-level", level);
}
pub(report.type, report);
});
Expand Down
42 changes: 0 additions & 42 deletions src/w3c/aria.js

This file was deleted.

4 changes: 2 additions & 2 deletions tests/spec/w3c/headers-spec.js
Expand Up @@ -180,7 +180,7 @@ describe("W3C — Headers", function() {
var orcidAnchor = doc.querySelector("a[href='" + oricdHref + "']");
var twitterAnchor = doc.querySelector("a[href='" + twitterHref + "']");
// general checks
var header = doc.querySelector("#respecHeader");
var header = doc.querySelector("div.head");
[orcidAnchor, twitterAnchor].forEach(function(elem) {
// Check parent is correct.
expect(elem.parentNode.localName).toEqual("span");
Expand Down Expand Up @@ -343,7 +343,7 @@ describe("W3C — Headers", function() {
};
Object.assign(ops.config, newProps);
const doc = await makeRSDoc(ops);
var licenses = doc.querySelectorAll("#respecHeader a[rel=license]");
var licenses = doc.querySelectorAll("div.head a[rel=license]");
expect(licenses.length).toEqual(1);
expect(licenses.item(0).tagName).toEqual("A");
expect(licenses.item(0).href).toEqual(
Expand Down

0 comments on commit 332f952

Please sign in to comment.