GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tools,doc: fix version picker bug in html.js · nodejs/node@1625329

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • doctool
      • test-doctool-html.js
    • fixtures
      • altdocs.md
  • tools/doc
    • html.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/doctool/test-doctool-html.js‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.js
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ const testData = [
9595
html: '<ol><li>fish</li><li>fish</li></ol>' +
9696
'<ul><li>Red fish</li><li>Blue fish</li></ul>',
9797
},
98+
{
99+
file: fixtures.path('altdocs.md'),
100+
html: '<li><a href="https://nodejs.org/docs/latest-v8.x/api/foo.html">8.x',
101+
},
98102
];
99103

100104
const spaces = /\s/g;
@@ -117,7 +121,8 @@ testData.forEach(({ file, html }) => {
117121
const actual = output.replace(spaces, '');
118122
// Assert that the input stripped of all whitespace contains the
119123
// expected markup.
120-
assert(actual.includes(expected));
124+
assert(actual.includes(expected),
125+
`ACTUAL: ${actual}\nEXPECTED: ${expected}`);
121126
})
122127
);
123128
}));
Collapse file

‎test/fixtures/altdocs.md‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ALTDOCS
2+
<!--introduced_in=v8.4.0-->
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ function altDocs(filename, docCreated) {
427427
const [versionMajor, versionMinor] = version.num.split('.').map(Number);
428428
if (docCreatedMajor > versionMajor) return false;
429429
if (docCreatedMajor < versionMajor) return true;
430+
if (Number.isNaN(versionMinor)) return true;
430431
return docCreatedMinor <= versionMinor;
431432
}
432433

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.