summaryrefslogtreecommitdiff
path: root/test/doctool/test-doctool-html.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2018-11-24 23:06:55 -0800
committerRich Trott <rtrott@gmail.com>2018-11-27 19:14:54 -0800
commit6f64cda1ee578d121e328756ac7401f0ee8e1d62 (patch)
tree29fd981c58ffcb90b016027c122f435a2e08713b /test/doctool/test-doctool-html.js
parentcc399cf5b2253dd9f3bcdeeff422059d58795d75 (diff)
downloadandroid-node-v8-6f64cda1ee578d121e328756ac7401f0ee8e1d62.tar.gz
android-node-v8-6f64cda1ee578d121e328756ac7401f0ee8e1d62.tar.bz2
android-node-v8-6f64cda1ee578d121e328756ac7401f0ee8e1d62.zip
tools,doc: fix version picker bug in html.js
The processing of strings like `8.x` into a major version number and a minor version number results in minor versions that are `NaN`. In that situation, since the picker will link to the latest docs in the major version, include the version in the version picker. Fixes: https://github.com/nodejs/node/issues/23979 PR-URL: https://github.com/nodejs/node/pull/24638 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'test/doctool/test-doctool-html.js')
-rw-r--r--test/doctool/test-doctool-html.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 499034cd8a..703a7dcd21 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -95,6 +95,10 @@ const testData = [
html: '<ol><li>fish</li><li>fish</li></ol>' +
'<ul><li>Red fish</li><li>Blue fish</li></ul>',
},
+ {
+ file: fixtures.path('altdocs.md'),
+ html: '<li><a href="https://nodejs.org/docs/latest-v8.x/api/foo.html">8.x',
+ },
];
const spaces = /\s/g;
@@ -117,7 +121,8 @@ testData.forEach(({ file, html }) => {
const actual = output.replace(spaces, '');
// Assert that the input stripped of all whitespace contains the
// expected markup.
- assert(actual.includes(expected));
+ assert(actual.includes(expected),
+ `ACTUAL: ${actual}\nEXPECTED: ${expected}`);
})
);
}));