Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/core/linter-rules/no-headingless-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function run(conf) {
}
/** @type {NodeListOf<HTMLElement>} */
const sections = document.querySelectorAll(
"section:not(.head,#abstract,#sotd)"
"section:not(.head,.introductory,#abstract,#sotd)"
);
const offendingElements = [...sections].filter(
({ firstElementChild: e }) =>
Expand Down
15 changes: 15 additions & 0 deletions tests/spec/core/linter-rules/no-headingless-sections-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,19 @@ describe("Core Linter Rule - 'no-headingless-sections'", () => {
expect(warnings[0].elements).toHaveSize(1);
expect(warnings[0].elements[0].id).toBe("badone");
});

it("doesn't warn for introductory sections without headings", async () => {
const body = `
<section class="introductory">
<p>Some introductory content without a heading.</p>
</section>
<section>
<h2>Normal section</h2>
</section>
`;
const opts = makeStandardOps(config, body);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makeStandardOps is the correct name — it's exported from tests/spec/SpecHelper.js. Not a typo.

const doc = await makeRSDoc(opts);
const warnings = warningsFilter(doc);
expect(warnings).toHaveSize(0);
});
});
Loading