summaryrefslogtreecommitdiff
path: root/test/doctool/test-doctool-html.js
diff options
context:
space:
mode:
authorSam Ruby <rubys@intertwingly.net>2018-07-03 12:46:56 -0400
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-07-09 22:57:33 +0300
commit0c743b5f77a53f278d6d6554e69d2d55ef945f66 (patch)
tree18e34392c8f668d5c3777b259785c86606ede358 /test/doctool/test-doctool-html.js
parent1529ef4dc5e4cf99ea964bc1cc47cd62cca17540 (diff)
downloadandroid-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.tar.gz
android-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.tar.bz2
android-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.zip
tools: build all.json by combining generated JSON
Notes: 1) Removed a number of root properties that did not seem relevant: source, desc, and introduced_in. There no longer is a source, and the other two are from the first include and do not reflect the entire API. 2) As with https://github.com/nodejs/node/issues/20100, the current "desc" properties sometimes contained in-page links, other times referenced another page, and often did not match the links in the original HTML or JSON file. I chose to standardize on external links as "desc" values are isolated snippets as opposed to all.html which can be viewed as a standalone and self contained document. 3) Eliminated preprocessing for @include entirely, including the test case for this function. 4) _toc.md was renamed to index.md. 5) index comments no longer appear in embedded TOCs (left hand side column in the generated documentation. PR-URL: https://github.com/nodejs/node/pull/21637 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/doctool/test-doctool-html.js')
-rw-r--r--test/doctool/test-doctool-html.js64
1 files changed, 26 insertions, 38 deletions
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 0ca46c0ade..a6119c1690 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -11,7 +11,6 @@ try {
const assert = require('assert');
const { readFile } = require('fs');
const fixtures = require('../common/fixtures');
-const processIncludes = require('../../tools/doc/preprocess.js');
const toHTML = require('../../tools/doc/html.js');
// Test data is a list of objects with two properties.
@@ -65,15 +64,6 @@ const testData = [
'<p>Describe <code>Something</code> in more detail here. </p>'
},
{
- file: fixtures.path('doc_with_includes.md'),
- html: '<!-- [start-include:doc_inc_1.md] -->' +
- '<p>Look <a href="doc_inc_2.html#doc_inc_2_foobar">here</a>!</p>' +
- '<!-- [end-include:doc_inc_1.md] --><!-- [start-include:doc_inc_2.md] -->' +
- '<h1>foobar<span><a class="mark" href="#doc_inc_2_foobar" ' +
- 'id="doc_inc_2_foobar">#</a></span></h1>' +
- '<p>I exist and am being linked to.</p><!-- [end-include:doc_inc_2.md] -->'
- },
- {
file: fixtures.path('sample_document.md'),
html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
'<li>Bluefish</li></ol>',
@@ -90,36 +80,34 @@ testData.forEach(({ file, html, analyticsId }) => {
readFile(file, 'utf8', common.mustCall((err, input) => {
assert.ifError(err);
- processIncludes(file, input, common.mustCall((err, preprocessed) => {
- assert.ifError(err);
- toHTML(
- {
- input: preprocessed,
- filename: 'foo',
- nodeVersion: process.version,
- analytics: analyticsId,
- },
- common.mustCall((err, output) => {
- assert.ifError(err);
+ toHTML(
+ {
+ input: input,
+ filename: 'foo',
+ nodeVersion: process.version,
+ analytics: analyticsId,
+ },
+ common.mustCall((err, output) => {
+ assert.ifError(err);
- const actual = output.replace(spaces, '');
- // Assert that the input stripped of all whitespace contains the
- // expected markup.
- assert(actual.includes(expected));
+ const actual = output.replace(spaces, '');
+ // Assert that the input stripped of all whitespace contains the
+ // expected markup.
+ assert(actual.includes(expected));
- // Testing the insertion of Google Analytics script when
- // an analytics id is provided. Should not be present by default.
- const scriptDomain = 'google-analytics.com';
- if (includeAnalytics) {
- assert(actual.includes(scriptDomain),
- `Google Analytics script was not present in "${actual}"`);
- } else {
- assert.strictEqual(actual.includes(scriptDomain), false,
- 'Google Analytics script was present in ' +
- `"${actual}"`);
- }
- }));
- }));
+ // Testing the insertion of Google Analytics script when
+ // an analytics id is provided. Should not be present by default.
+ const scriptDomain = 'google-analytics.com';
+ if (includeAnalytics) {
+ assert(actual.includes(scriptDomain),
+ `Google Analytics script was not present in "${actual}"`);
+ } else {
+ assert.strictEqual(actual.includes(scriptDomain), false,
+ 'Google Analytics script was present in ' +
+ `"${actual}"`);
+ }
+ })
+ );
}));
});