fix(w3c/headers): always add History or FPWD (#4046)

This commit is contained in:
Marcos Cáceres 2022-02-21 09:27:11 +11:00 committed by GitHub
parent f496688ed5
commit d39d3e5cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -735,7 +735,8 @@ async function deriveHistoryURI(conf) {
);
// If it's on the Rec Track or it's TR worthy, then allow history override.
if (conf.historyURI && canShowHistory) {
// Also make a an exception for FPWD.
if ((conf.historyURI && canShowHistory) || conf.specStatus === "FPWD") {
conf.historyURI = historyURL.href;
return;
}

View File

@ -2505,6 +2505,23 @@ describe("W3C — Headers", () => {
expect(historyLink.href).toBe("http://example.com/history");
});
it("generates the history URL for FPWD without checking if it exists", async () => {
const ops = makeStandardOps({
shortName: "test",
specStatus: "FPWD",
group: "webapps",
});
const doc = await makeRSDoc(ops);
const [history] = contains(doc, ".head dt", "History:");
expect(history).toBeTruthy();
expect(history.nextElementSibling).toBeTruthy();
const historyLink = history.nextElementSibling.querySelector("a");
expect(historyLink).toBeTruthy();
expect(historyLink.href).toBe(
"https://www.w3.org/standards/history/test"
);
});
it("allowing removing the history entirely by nulling it out", async () => {
const ops = makeStandardOps({
shortName: "test",