Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fix(core/issues-notes): heading should be h1 (speced#3998)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres authored Feb 1, 2022
1 parent fcda45d commit fa54ce6
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/issues-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function makeIssueSectionSummary(issueList) {
) {
issueSummaryElement.insertAdjacentHTML(
"afterbegin",
`<h2>${l10n.issue_summary}</h2>`
`<h1>${l10n.issue_summary}</h1>`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dini/conformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function processConformance(conformance, conf) {
);
const plural = terms.length > 1;
const content = html`
<h2>${l10n.conformance}</h2>
<h1>${l10n.conformance}</h1>
<p>${l10n.normativity}</p>
${terms.length ? l10n.keywordInterpretation(keywords, plural) : null}
`;
Expand Down
2 changes: 1 addition & 1 deletion src/w3c/conformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function processConformance(conformance, conf) {
);
const plural = terms.length > 1;
const content = html`
<h2>${l10n.conformance}</h2>
<h1>${l10n.conformance}</h1>
<p>${l10n.normativity}</p>
${terms.length ? l10n.keywordInterpretation(keywords, plural) : null}
`;
Expand Down
69 changes: 69 additions & 0 deletions tests/spec/core/markdown-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,73 @@ function getAnswer() {
expect(p.localName).toBe("p");
});
});

it("retains heading order with generated sections", async () => {
const body = `
<section id="abstract">
Some abstract.
</section>
<section id="sotd">
Status.
</section>
# First section
This paragraph MUST.
<aside class="issue">
An issue.
</aside>
## Sub section
This is sub-section paragraph.
<aside class="practice">
<p class="practicedesc">
<span class="practicelab">Best practice</span>
</p>
</aside>
<figure>
<figcaption>Figure caption</figcaption>
</figure>
<section id="conformance"></section>
<section id="issue-summary"></section>
<section id="bp-summary"></section>
<section id="tof"></section>
<section class="appendix">
# Acknowledgements
Thanks to everyone.
</section>
<section id="idl-index"></section>
<!-- References will appear last -->
`;
const ops = makeStandardOps({ format: "markdown" }, body);
ops.abstract = null;
const doc = await makeRSDoc(ops);
const headings = doc.querySelectorAll("body > section > h2");
const headingTitles = [
"Abstract",
"Status of This Document",
"1. First section",
"2. Conformance",
"3. Issue summary",
"4. Best Practices Summary",
"5. List of Figures",
"A. Acknowledgements",
"B. IDL Index",
"C. References",
];
expect(headings).toHaveSize(headingTitles.length);
for (const heading of headings) {
const title = heading.textContent.trim();
expect(title).toContain(headingTitles.shift());
}
});
});

0 comments on commit fa54ce6

Please sign in to comment.