@diplodoc/cli-tests 0.0.0-rc-reusable-e2es-202504041505
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.mjs +30 -0
- package/e2e/__snapshots__/generate-map.spec.ts.snap +63 -0
- package/e2e/__snapshots__/include-toc.test.ts.snap +464 -0
- package/e2e/__snapshots__/load-custom-resources.spec.ts.snap +487 -0
- package/e2e/__snapshots__/metadata.spec.ts.snap +241 -0
- package/e2e/__snapshots__/plugin-corner-cases.spec.ts.snap +0 -0
- package/e2e/__snapshots__/regression.test.ts.snap +1168 -0
- package/e2e/__snapshots__/rtl.spec.ts.snap +357 -0
- package/e2e/generate-map.spec.ts +40 -0
- package/e2e/include-toc.test.ts +57 -0
- package/e2e/load-custom-resources.spec.ts +37 -0
- package/e2e/metadata.spec.ts +27 -0
- package/e2e/plugin-corner-cases.spec.ts +16 -0
- package/e2e/regression.test.ts +34 -0
- package/e2e/rtl.spec.ts +30 -0
- package/fixtures/cliAdapter.ts +39 -0
- package/fixtures/index.ts +3 -0
- package/fixtures/runners/binary.ts +31 -0
- package/fixtures/runners/index.ts +15 -0
- package/fixtures/runners/source.ts +20 -0
- package/fixtures/runners/types.ts +4 -0
- package/fixtures/utils/file.ts +43 -0
- package/fixtures/utils/test.ts +31 -0
- package/mocks/fileContent/metadata/authorAliasInMetadata.md +7 -0
- package/mocks/fileContent/metadata/fullAuthorInMetadata.md +10 -0
- package/mocks/fileContent/metadata/includesContent/firstIncludeFile.md +7 -0
- package/mocks/fileContent/metadata/includesContent/secondIncludeFile.md +5 -0
- package/mocks/fileContent/metadata/includesContent/withIncludes.md +7 -0
- package/mocks/fileContent/metadata/keywordsInMetadata.md +9 -0
- package/mocks/fileContent/metadata/simpleMetadata.md +6 -0
- package/mocks/fileContent/metadata/substitutionsInMetadataPropertyKeys.md +7 -0
- package/mocks/fileContent/metadata/substitutionsInMetadataPropertyValues.md +11 -0
- package/mocks/fileContent/metadata/substitutionsWithEmptyString.md +7 -0
- package/mocks/fileContent/metadata/variableInMetadata.md +7 -0
- package/mocks/fileContent/metadata/withAdditionalSeparatorsInContent.md +9 -0
- package/mocks/fileContent/metadata/withoutMetadata.md +2 -0
- package/mocks/fileContent/metadata/withoutMetadataWithAdditionalSeparatorsInContent.md +6 -0
- package/mocks/generate-map/test1/input/.yfm +0 -0
- package/mocks/generate-map/test1/input/ru/_includes/file.md +0 -0
- package/mocks/generate-map/test1/input/ru/_includes/plugins.md +0 -0
- package/mocks/generate-map/test1/input/ru/folder1/a1.md +1 -0
- package/mocks/generate-map/test1/input/ru/folder1/folder2/a1.md +1 -0
- package/mocks/generate-map/test1/input/ru/folder1/folder2/toc.yaml +5 -0
- package/mocks/generate-map/test1/input/ru/folder1/toc.yaml +7 -0
- package/mocks/generate-map/test1/input/ru/index.md +0 -0
- package/mocks/generate-map/test1/input/ru/plugins/import.md +0 -0
- package/mocks/generate-map/test1/input/ru/plugins/index.md +0 -0
- package/mocks/generate-map/test1/input/ru/project/config.md +0 -0
- package/mocks/generate-map/test1/input/ru/project/index.md +0 -0
- package/mocks/generate-map/test1/input/ru/settings.md +0 -0
- package/mocks/generate-map/test1/input/ru/toc.yaml +22 -0
- package/mocks/generate-map/test2/input/en/_includes/file.md +0 -0
- package/mocks/generate-map/test2/input/en/_includes/plugins.md +0 -0
- package/mocks/generate-map/test2/input/en/index.md +0 -0
- package/mocks/generate-map/test2/input/en/plugins/import.md +0 -0
- package/mocks/generate-map/test2/input/en/plugins/index.md +0 -0
- package/mocks/generate-map/test2/input/en/project/config.md +0 -0
- package/mocks/generate-map/test2/input/en/project/index.md +0 -0
- package/mocks/generate-map/test2/input/en/settings.md +0 -0
- package/mocks/generate-map/test2/input/en/toc.yaml +18 -0
- package/mocks/generate-map/test2/input/ru/_includes/file.md +0 -0
- package/mocks/generate-map/test2/input/ru/_includes/plugins.md +0 -0
- package/mocks/generate-map/test2/input/ru/index.md +0 -0
- package/mocks/generate-map/test2/input/ru/plugins/import.md +0 -0
- package/mocks/generate-map/test2/input/ru/plugins/index.md +0 -0
- package/mocks/generate-map/test2/input/ru/project/config.md +0 -0
- package/mocks/generate-map/test2/input/ru/project/index.md +0 -0
- package/mocks/generate-map/test2/input/ru/settings.md +0 -0
- package/mocks/generate-map/test2/input/ru/toc.yaml +18 -0
- package/mocks/generate-map/test3/input/.yfm +0 -0
- package/mocks/generate-map/test3/input/ru/_includes/file.md +0 -0
- package/mocks/generate-map/test3/input/ru/_includes/plugins.md +0 -0
- package/mocks/generate-map/test3/input/ru/folder1/a1.md +1 -0
- package/mocks/generate-map/test3/input/ru/folder1/folder2/a1.md +1 -0
- package/mocks/generate-map/test3/input/ru/folder1/folder2/toc.yaml +5 -0
- package/mocks/generate-map/test3/input/ru/folder1/toc.yaml +7 -0
- package/mocks/generate-map/test3/input/ru/index.md +0 -0
- package/mocks/generate-map/test3/input/ru/plugins/import.md +0 -0
- package/mocks/generate-map/test3/input/ru/plugins/index.md +0 -0
- package/mocks/generate-map/test3/input/ru/project/config.md +0 -0
- package/mocks/generate-map/test3/input/ru/project/index.md +0 -0
- package/mocks/generate-map/test3/input/ru/settings.md +0 -0
- package/mocks/generate-map/test3/input/ru/toc.yaml +22 -0
- package/mocks/include-toc/test1/input/a1.md +1 -0
- package/mocks/include-toc/test1/input/folder1/a1.md +1 -0
- package/mocks/include-toc/test1/input/folder1/folder2/a1.md +1 -0
- package/mocks/include-toc/test1/input/folder1/folder2/toc.yaml +5 -0
- package/mocks/include-toc/test1/input/folder1/toc.yaml +7 -0
- package/mocks/include-toc/test1/input/toc.yaml +9 -0
- package/mocks/include-toc/test2/input/.yfm +1 -0
- package/mocks/include-toc/test2/input/file1.md +1 -0
- package/mocks/include-toc/test2/input/fileX.md +1 -0
- package/mocks/include-toc/test2/input/folder/fileA.md +11 -0
- package/mocks/include-toc/test2/input/folder/fileB.md +9 -0
- package/mocks/include-toc/test2/input/folder/folder/fileC.md +1 -0
- package/mocks/include-toc/test2/input/folder/folder/toc.yaml +3 -0
- package/mocks/include-toc/test2/input/folder/toc.yaml +6 -0
- package/mocks/include-toc/test2/input/presets.yaml +2 -0
- package/mocks/include-toc/test2/input/toc.yaml +6 -0
- package/mocks/include-toc/test3/input/product1/core/_includes/inc.md +1 -0
- package/mocks/include-toc/test3/input/product1/core/article1.md +3 -0
- package/mocks/include-toc/test3/input/product1/core/toc_m.yaml +2 -0
- package/mocks/include-toc/test3/input/product1/product/toc_p.yaml +3 -0
- package/mocks/include-toc/test3/input/product1/toc.yaml +3 -0
- package/mocks/include-toc/test3/input/product2/core/_includes/inc.md +1 -0
- package/mocks/include-toc/test3/input/product2/core/article1.md +3 -0
- package/mocks/include-toc/test3/input/product2/core/toc_m.yaml +2 -0
- package/mocks/include-toc/test3/input/product2/overlay1/product/article1.md +3 -0
- package/mocks/include-toc/test3/input/product2/overlay1/product/toc_p.yaml +3 -0
- package/mocks/include-toc/test3/input/product2/overlay1/toc.yaml +2 -0
- package/mocks/include-toc/test3/input/product2/overlay2/product/article1.md +3 -0
- package/mocks/include-toc/test3/input/product2/overlay2/product/toc_p.yaml +3 -0
- package/mocks/include-toc/test3/input/product2/overlay2/toc.yaml +2 -0
- package/mocks/include-toc/test3/input/product2/overlay3/product/toc_p.yaml +3 -0
- package/mocks/include-toc/test3/input/product2/overlay3/toc.yaml +2 -0
- package/mocks/include-toc/test3/input/product2/p2.md +4 -0
- package/mocks/include-toc/test3/input/product2/toc.yaml +10 -0
- package/mocks/include-toc/test4/input/a1.md +1 -0
- package/mocks/include-toc/test4/input/index.yaml +20 -0
- package/mocks/include-toc/test4/input/toc.yaml +9 -0
- package/mocks/include-toc/test5/input/core/concepts/toc_i.yaml +2 -0
- package/mocks/include-toc/test5/input/core/concepts/toc_p.yaml +3 -0
- package/mocks/include-toc/test5/input/core/toc_i.yaml +6 -0
- package/mocks/include-toc/test5/input/core/toc_m.yaml +3 -0
- package/mocks/include-toc/test5/input/core/toc_p.yaml +5 -0
- package/mocks/include-toc/test5/input/overlay/toc_p.yaml +3 -0
- package/mocks/include-toc/test5/input/toc.yaml +4 -0
- package/mocks/include-toc/test6/input/test/index.md +4 -0
- package/mocks/include-toc/test6/input/test/sub/sub/sub-3.md +1 -0
- package/mocks/include-toc/test6/input/test/sub/sub-1.md +5 -0
- package/mocks/include-toc/test6/input/test/sub/sub-2.md +1 -0
- package/mocks/include-toc/test6/input/test/test.md +1 -0
- package/mocks/include-toc/test6/input/toc.yaml +7 -0
- package/mocks/include-toc/test7/input/.yfm +1 -0
- package/mocks/include-toc/test7/input/ru/presets.yaml +2 -0
- package/mocks/include-toc/test7/input/ru/sub/folder/index.yaml +4 -0
- package/mocks/include-toc/test7/input/ru/sub/folder/toc.yaml +3 -0
- package/mocks/include-toc/test7/input/ru/toc.yaml +3 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/.yfm +5 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/_assets/script/test1.js +0 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/_assets/style/test.css +13 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/index.yaml +9 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/page.md +7 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/project/config.md +1 -0
- package/mocks/load-custom-resources/md2html-with-resources/input/toc.yaml +7 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/.yfm +5 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/_assets/script/test1.js +0 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/_assets/style/test.css +13 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/index.yaml +9 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/page.md +7 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/project/config.md +1 -0
- package/mocks/load-custom-resources/md2md-with-resources/input/toc.yaml +7 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/.yfm +5 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/_assets/script/test1.js +0 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/_assets/style/test.css +13 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/index.yaml +9 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/page.md +7 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/project/config.md +1 -0
- package/mocks/load-custom-resources/single-page-with-resources/input/toc.yaml +7 -0
- package/mocks/metadata/md2html-with-metadata/input/index.yaml +9 -0
- package/mocks/metadata/md2html-with-metadata/input/page.md +7 -0
- package/mocks/metadata/md2html-with-metadata/input/presets.yaml +6 -0
- package/mocks/metadata/md2html-with-metadata/input/project/config.md +7 -0
- package/mocks/metadata/md2html-with-metadata/input/toc.yaml +7 -0
- package/mocks/metadata/md2md-with-metadata/input/index.yaml +9 -0
- package/mocks/metadata/md2md-with-metadata/input/page.md +7 -0
- package/mocks/metadata/md2md-with-metadata/input/presets.yaml +6 -0
- package/mocks/metadata/md2md-with-metadata/input/project/config.md +7 -0
- package/mocks/metadata/md2md-with-metadata/input/toc.yaml +7 -0
- package/mocks/plugin-corner-cases/images-in-deflists/input/image.jpeg +0 -0
- package/mocks/plugin-corner-cases/images-in-deflists/input/index.md +5 -0
- package/mocks/plugin-corner-cases/images-in-deflists/input/toc.yaml +4 -0
- package/mocks/regression/input/1.md +27 -0
- package/mocks/regression/input/_assets/1.png +0 -0
- package/mocks/regression/input/_assets/2.png +0 -0
- package/mocks/regression/input/_assets/3.png +0 -0
- package/mocks/regression/input/_assets/4.png +0 -0
- package/mocks/regression/input/_assets/empty.pdf +0 -0
- package/mocks/regression/input/autotitle.md +23 -0
- package/mocks/regression/input/commented-include.md +3 -0
- package/mocks/regression/input/images.md +9 -0
- package/mocks/regression/input/included-item.md +13 -0
- package/mocks/regression/input/includes/presets.yaml +2 -0
- package/mocks/regression/input/includes/test.md +1 -0
- package/mocks/regression/input/includes/user.md +1 -0
- package/mocks/regression/input/includes.md +5 -0
- package/mocks/regression/input/index.yaml +9 -0
- package/mocks/regression/input/latex.md +3 -0
- package/mocks/regression/input/merge/merge.md +3 -0
- package/mocks/regression/input/merge/presets.yaml +2 -0
- package/mocks/regression/input/merge/toc.yaml +4 -0
- package/mocks/regression/input/merge-source/merged.md +3 -0
- package/mocks/regression/input/merge-source/toc-m.yaml +4 -0
- package/mocks/regression/input/mermaid.md +13 -0
- package/mocks/regression/input/openapi-spec.yaml +37 -0
- package/mocks/regression/input/presets.yaml +8 -0
- package/mocks/regression/input/sub/folder/item-1.md +3 -0
- package/mocks/regression/input/sub/toc.yaml +5 -0
- package/mocks/regression/input/toc-i.yaml +3 -0
- package/mocks/regression/input/toc.yaml +30 -0
- package/mocks/rtl/multidirectional-languages/input/.yfm +1 -0
- package/mocks/rtl/multidirectional-languages/input/ar/index.yaml +4 -0
- package/mocks/rtl/multidirectional-languages/input/ar/page.md +1 -0
- package/mocks/rtl/multidirectional-languages/input/ar/toc.yaml +5 -0
- package/mocks/rtl/multidirectional-languages/input/en/index.yaml +9 -0
- package/mocks/rtl/multidirectional-languages/input/en/page.md +7 -0
- package/mocks/rtl/multidirectional-languages/input/en/toc.yaml +5 -0
- package/mocks/rtl/rtl-language/input/.yfm +1 -0
- package/mocks/rtl/rtl-language/input/index.yaml +4 -0
- package/mocks/rtl/rtl-language/input/page.md +1 -0
- package/mocks/rtl/rtl-language/input/toc.yaml +5 -0
- package/package.json +42 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +30 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with only one rtl lang > .yfm 1`] = `"langs: ['he']"`;
|
|
4
|
+
|
|
5
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with only one rtl lang > filelist 1`] = `
|
|
6
|
+
"[
|
|
7
|
+
".yfm",
|
|
8
|
+
"_bundle/search-async-0",
|
|
9
|
+
"_bundle/app-css-1",
|
|
10
|
+
"_bundle/app-js-1",
|
|
11
|
+
"_bundle/search-css-2",
|
|
12
|
+
"_bundle/latex-extension.css",
|
|
13
|
+
"_bundle/latex-extension.js",
|
|
14
|
+
"_bundle/mermaid-extension.js",
|
|
15
|
+
"_bundle/search-js-0",
|
|
16
|
+
"_bundle/search-js-1",
|
|
17
|
+
"_bundle/search-css-0",
|
|
18
|
+
"_bundle/search-js-2",
|
|
19
|
+
"_bundle/search-css-1",
|
|
20
|
+
"index.html",
|
|
21
|
+
"page.html",
|
|
22
|
+
"toc.js"
|
|
23
|
+
]"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with only one rtl lang > index.html 1`] = `
|
|
27
|
+
"
|
|
28
|
+
<!DOCTYPE html>
|
|
29
|
+
<html lang="he" dir="rtl">
|
|
30
|
+
<head>
|
|
31
|
+
<meta charset="utf-8">
|
|
32
|
+
<base href="./" />
|
|
33
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
37
|
+
<title>Documentation</title>
|
|
38
|
+
<style type="text/css">
|
|
39
|
+
body {
|
|
40
|
+
height: 100vh;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
43
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-1" />
|
|
44
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-2" />
|
|
45
|
+
|
|
46
|
+
</head>
|
|
47
|
+
<body class="g-root g-root_theme_light">
|
|
48
|
+
<div id="root"></div>
|
|
49
|
+
<script type="application/json" id="diplodoc-state">
|
|
50
|
+
{"data":{"data":{"title":"Documentation","links":[{"title":"Documentation","href":"page.html"}],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]}},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"","leading":true},"router":{"pathname":"index","depth":1},"lang":"he","langs":["he"]}
|
|
51
|
+
</script>
|
|
52
|
+
<script type="application/javascript">
|
|
53
|
+
function unescapeJsonFromHtml(escaped) {
|
|
54
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
55
|
+
return JSON.parse(unescaped);
|
|
56
|
+
}
|
|
57
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
58
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
59
|
+
window.STATIC_CONTENT = false;
|
|
60
|
+
</script>
|
|
61
|
+
<script src="toc.js" type="application/javascript"></script>
|
|
62
|
+
|
|
63
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
64
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
65
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
68
|
+
"
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with only one rtl lang > page.html 1`] = `
|
|
72
|
+
"
|
|
73
|
+
<!DOCTYPE html>
|
|
74
|
+
<html lang="he" dir="rtl">
|
|
75
|
+
<head>
|
|
76
|
+
<meta charset="utf-8">
|
|
77
|
+
<base href="./" />
|
|
78
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
82
|
+
<title>Documentation</title>
|
|
83
|
+
<style type="text/css">
|
|
84
|
+
body {
|
|
85
|
+
height: 100vh;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
88
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-1" />
|
|
89
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-2" />
|
|
90
|
+
|
|
91
|
+
</head>
|
|
92
|
+
<body class="g-root g-root_theme_light">
|
|
93
|
+
<div id="root"></div>
|
|
94
|
+
<script type="application/json" id="diplodoc-state">
|
|
95
|
+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"assets":[],"headings":[],"title":"","includes":[],"html":"<p>תיעוד</p>/n","leading":false},"router":{"pathname":"page","depth":1},"lang":"he","langs":["he"]}
|
|
96
|
+
</script>
|
|
97
|
+
<script type="application/javascript">
|
|
98
|
+
function unescapeJsonFromHtml(escaped) {
|
|
99
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
100
|
+
return JSON.parse(unescaped);
|
|
101
|
+
}
|
|
102
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
103
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
104
|
+
window.STATIC_CONTENT = false;
|
|
105
|
+
</script>
|
|
106
|
+
<script src="toc.js" type="application/javascript"></script>
|
|
107
|
+
|
|
108
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
109
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
110
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
111
|
+
</body>
|
|
112
|
+
</html>
|
|
113
|
+
"
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with only one rtl lang > toc.js 1`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"index.html","items":[{"name":"Documentation","href":"page.html","id":"UUID"}],"id":"UUID"};"`;
|
|
117
|
+
|
|
118
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > .yfm 1`] = `"langs: ['ar', 'en']"`;
|
|
119
|
+
|
|
120
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > ar/index.html 1`] = `
|
|
121
|
+
"
|
|
122
|
+
<!DOCTYPE html>
|
|
123
|
+
<html lang="ar" dir="rtl">
|
|
124
|
+
<head>
|
|
125
|
+
<meta charset="utf-8">
|
|
126
|
+
<base href="../" />
|
|
127
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
131
|
+
<title>Documentation</title>
|
|
132
|
+
<style type="text/css">
|
|
133
|
+
body {
|
|
134
|
+
height: 100vh;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
137
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-1" />
|
|
138
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-2" />
|
|
139
|
+
|
|
140
|
+
</head>
|
|
141
|
+
<body class="g-root g-root_theme_light">
|
|
142
|
+
<div id="root"></div>
|
|
143
|
+
<script type="application/json" id="diplodoc-state">
|
|
144
|
+
{"data":{"data":{"title":"Documentation","links":[{"title":"Documentation","href":"ar/page.html"}],"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]}},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"title":"","leading":true},"router":{"pathname":"ar/index","depth":2},"lang":"ar","langs":["ar","en"]}
|
|
145
|
+
</script>
|
|
146
|
+
<script type="application/javascript">
|
|
147
|
+
function unescapeJsonFromHtml(escaped) {
|
|
148
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
149
|
+
return JSON.parse(unescaped);
|
|
150
|
+
}
|
|
151
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
152
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
153
|
+
window.STATIC_CONTENT = false;
|
|
154
|
+
</script>
|
|
155
|
+
<script src="ar/toc.js" type="application/javascript"></script>
|
|
156
|
+
|
|
157
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
158
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
159
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|
|
162
|
+
"
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > ar/page.html 1`] = `
|
|
166
|
+
"
|
|
167
|
+
<!DOCTYPE html>
|
|
168
|
+
<html lang="ar" dir="rtl">
|
|
169
|
+
<head>
|
|
170
|
+
<meta charset="utf-8">
|
|
171
|
+
<base href="../" />
|
|
172
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
176
|
+
<title>Documentation</title>
|
|
177
|
+
<style type="text/css">
|
|
178
|
+
body {
|
|
179
|
+
height: 100vh;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
182
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-1" />
|
|
183
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-2" />
|
|
184
|
+
|
|
185
|
+
</head>
|
|
186
|
+
<body class="g-root g-root_theme_light">
|
|
187
|
+
<div id="root"></div>
|
|
188
|
+
<script type="application/json" id="diplodoc-state">
|
|
189
|
+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"assets":[],"headings":[],"title":"","includes":[],"html":"<p>توثيق</p>/n","leading":false},"router":{"pathname":"ar/page","depth":2},"lang":"ar","langs":["ar","en"]}
|
|
190
|
+
</script>
|
|
191
|
+
<script type="application/javascript">
|
|
192
|
+
function unescapeJsonFromHtml(escaped) {
|
|
193
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
194
|
+
return JSON.parse(unescaped);
|
|
195
|
+
}
|
|
196
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
197
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
198
|
+
window.STATIC_CONTENT = false;
|
|
199
|
+
</script>
|
|
200
|
+
<script src="ar/toc.js" type="application/javascript"></script>
|
|
201
|
+
|
|
202
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
203
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
204
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
205
|
+
</body>
|
|
206
|
+
</html>
|
|
207
|
+
"
|
|
208
|
+
`;
|
|
209
|
+
|
|
210
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > ar/toc.js 1`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"ar/index.html","items":[{"name":"Documentation","href":"ar/page.html","id":"UUID"}],"id":"UUID"};"`;
|
|
211
|
+
|
|
212
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > en/index.html 1`] = `
|
|
213
|
+
"
|
|
214
|
+
<!DOCTYPE html>
|
|
215
|
+
<html lang="en" dir="ltr">
|
|
216
|
+
<head>
|
|
217
|
+
<meta charset="utf-8">
|
|
218
|
+
<base href="../" />
|
|
219
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
220
|
+
<meta name="title" content="Documentation" />
|
|
221
|
+
<meta name="noIndex" content="true" />
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
225
|
+
<title>Documentation | Documentation</title>
|
|
226
|
+
<style type="text/css">
|
|
227
|
+
body {
|
|
228
|
+
height: 100vh;
|
|
229
|
+
}
|
|
230
|
+
</style>
|
|
231
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0" />
|
|
232
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1" />
|
|
233
|
+
|
|
234
|
+
</head>
|
|
235
|
+
<body class="g-root g-root_theme_light">
|
|
236
|
+
<div id="root"></div>
|
|
237
|
+
<script type="application/json" id="diplodoc-state">
|
|
238
|
+
{"data":{"data":{"title":"Documentation","description":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"title":"Documentation","noIndex":true},"links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"en/page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"title":"Documentation","noIndex":true},"title":"Documentation","leading":true},"router":{"pathname":"en/index","depth":2},"lang":"en","langs":["ar","en"]}
|
|
239
|
+
</script>
|
|
240
|
+
<script type="application/javascript">
|
|
241
|
+
function unescapeJsonFromHtml(escaped) {
|
|
242
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
243
|
+
return JSON.parse(unescaped);
|
|
244
|
+
}
|
|
245
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
246
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
247
|
+
window.STATIC_CONTENT = false;
|
|
248
|
+
</script>
|
|
249
|
+
<script src="en/toc.js" type="application/javascript"></script>
|
|
250
|
+
|
|
251
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
252
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
253
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
254
|
+
</body>
|
|
255
|
+
</html>
|
|
256
|
+
"
|
|
257
|
+
`;
|
|
258
|
+
|
|
259
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > en/page.html 1`] = `
|
|
260
|
+
"
|
|
261
|
+
<!DOCTYPE html>
|
|
262
|
+
<html lang="en" dir="ltr">
|
|
263
|
+
<head>
|
|
264
|
+
<meta charset="utf-8">
|
|
265
|
+
<base href="../" />
|
|
266
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION" />
|
|
267
|
+
<meta name="yfm" content="builder" />
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
271
|
+
<title>Documentation</title>
|
|
272
|
+
<style type="text/css">
|
|
273
|
+
body {
|
|
274
|
+
height: 100vh;
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
277
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-0" />
|
|
278
|
+
<link type="text/css" rel="stylesheet" href="_bundle/app-css-1" />
|
|
279
|
+
|
|
280
|
+
</head>
|
|
281
|
+
<body class="g-root g-root_theme_light">
|
|
282
|
+
<div id="root"></div>
|
|
283
|
+
<script type="application/json" id="diplodoc-state">
|
|
284
|
+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder"}]},"assets":[],"headings":[],"title":"","includes":[],"html":"<p>Lorem</p>/n","leading":false},"router":{"pathname":"en/page","depth":2},"lang":"en","langs":["ar","en"]}
|
|
285
|
+
</script>
|
|
286
|
+
<script type="application/javascript">
|
|
287
|
+
function unescapeJsonFromHtml(escaped) {
|
|
288
|
+
const unescaped = escaped.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
289
|
+
return JSON.parse(unescaped);
|
|
290
|
+
}
|
|
291
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
292
|
+
window.__DATA__ = unescapeJsonFromHtml(data.innerText);
|
|
293
|
+
window.STATIC_CONTENT = false;
|
|
294
|
+
</script>
|
|
295
|
+
<script src="en/toc.js" type="application/javascript"></script>
|
|
296
|
+
|
|
297
|
+
<script type="application/javascript" src="_bundle/search-js-0"></script>
|
|
298
|
+
<script type="application/javascript" src="_bundle/app-js-1"></script>
|
|
299
|
+
<script type="application/javascript" src="_bundle/search-js-2"></script>
|
|
300
|
+
</body>
|
|
301
|
+
</html>
|
|
302
|
+
"
|
|
303
|
+
`;
|
|
304
|
+
|
|
305
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > en/toc.js 1`] = `"window.__DATA__.data.toc = {"title":"Documentation","href":"en/index.html","items":[{"name":"Documentation","href":"en/page.html","id":"UUID"}],"id":"UUID"};"`;
|
|
306
|
+
|
|
307
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > filelist 1`] = `
|
|
308
|
+
"[
|
|
309
|
+
".yfm",
|
|
310
|
+
"_bundle/search-async-0",
|
|
311
|
+
"_bundle/app-css-1",
|
|
312
|
+
"_bundle/app-js-1",
|
|
313
|
+
"_bundle/search-css-2",
|
|
314
|
+
"_bundle/latex-extension.css",
|
|
315
|
+
"_bundle/latex-extension.js",
|
|
316
|
+
"_bundle/mermaid-extension.js",
|
|
317
|
+
"_bundle/search-js-0",
|
|
318
|
+
"_bundle/search-js-1",
|
|
319
|
+
"_bundle/search-css-0",
|
|
320
|
+
"_bundle/search-js-2",
|
|
321
|
+
"_bundle/search-css-1",
|
|
322
|
+
"ar/index.html",
|
|
323
|
+
"ar/page.html",
|
|
324
|
+
"ar/toc.js",
|
|
325
|
+
"en/index.html",
|
|
326
|
+
"en/page.html",
|
|
327
|
+
"en/toc.js",
|
|
328
|
+
"index.html"
|
|
329
|
+
]"
|
|
330
|
+
`;
|
|
331
|
+
|
|
332
|
+
exports[`Generate html document with correct lang and dir attributes. Load correct bundles. > documentation with rtl and ltr langs > index.html 1`] = `
|
|
333
|
+
"
|
|
334
|
+
<!DOCTYPE html>
|
|
335
|
+
<html lang="ar" dir="rtl">
|
|
336
|
+
<head>
|
|
337
|
+
<meta charset="utf-8">
|
|
338
|
+
<meta http-equiv="refresh" content="0; url=./ar/index.html">
|
|
339
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
340
|
+
<title>Redirect</title>
|
|
341
|
+
<style type="text/css">
|
|
342
|
+
body {
|
|
343
|
+
height: 100vh;
|
|
344
|
+
}
|
|
345
|
+
</style>
|
|
346
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-1" />
|
|
347
|
+
<link type="text/css" rel="stylesheet" href="_bundle/search-css-2" />
|
|
348
|
+
<script type="text/javascript">
|
|
349
|
+
window.location.replace("./ar/index.html");
|
|
350
|
+
</script>
|
|
351
|
+
</head>
|
|
352
|
+
<body class="g-root g-root_theme_light">
|
|
353
|
+
If you are not redirected automatically, follow this <a href="./ar/index.html">link to example</a>.
|
|
354
|
+
</body>
|
|
355
|
+
</html>
|
|
356
|
+
"
|
|
357
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {describe, expect, test} from 'vitest';
|
|
2
|
+
import {bundleless, getFileContent, getTestPaths} from '../fixtures';
|
|
3
|
+
import {join} from 'path';
|
|
4
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
5
|
+
|
|
6
|
+
const generateMapTestTemplate = (
|
|
7
|
+
testTitle: string,
|
|
8
|
+
testRootPath: string,
|
|
9
|
+
md2md = true,
|
|
10
|
+
md2html = true,
|
|
11
|
+
) => {
|
|
12
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
13
|
+
|
|
14
|
+
test(testTitle, async () => {
|
|
15
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
16
|
+
|
|
17
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md, md2html, args: '--add-map-file'});
|
|
18
|
+
|
|
19
|
+
const content = getFileContent(join(outputPath, 'files.json'));
|
|
20
|
+
|
|
21
|
+
expect(bundleless(content)).toMatchSnapshot();
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
describe('Generate map for', () => {
|
|
26
|
+
generateMapTestTemplate(
|
|
27
|
+
'project with single language and toc include',
|
|
28
|
+
'mocks/generate-map/test1',
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
generateMapTestTemplate(
|
|
32
|
+
'project with single language and toc include - only md2html',
|
|
33
|
+
'mocks/generate-map/test1',
|
|
34
|
+
false,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
generateMapTestTemplate('project with multiple language', 'mocks/generate-map/test2');
|
|
38
|
+
|
|
39
|
+
generateMapTestTemplate('project with external links in toc', 'mocks/generate-map/test3');
|
|
40
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
4
|
+
|
|
5
|
+
describe('Include toc', () => {
|
|
6
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
7
|
+
|
|
8
|
+
test('Toc is included in link mode', async () => {
|
|
9
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test1');
|
|
10
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
11
|
+
compareDirectories(outputPath);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('Toc is included inline, not as a new section', async () => {
|
|
15
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test2');
|
|
16
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
17
|
+
compareDirectories(outputPath);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('Nested toc inclusions with mixed including modes', async () => {
|
|
21
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test3');
|
|
22
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
23
|
+
compareDirectories(outputPath);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Nested toc inclusions with mixed including modes 2', async () => {
|
|
27
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test5');
|
|
28
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
29
|
+
compareDirectories(outputPath);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('Toc with expressions', async () => {
|
|
33
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test4');
|
|
34
|
+
const vars = {
|
|
35
|
+
type: 'a',
|
|
36
|
+
a: 'A',
|
|
37
|
+
b: 'B',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {
|
|
41
|
+
args: `--vars=${JSON.stringify(vars)}`,
|
|
42
|
+
});
|
|
43
|
+
compareDirectories(outputPath);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('Toc with generic includer', async () => {
|
|
47
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test6');
|
|
48
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
49
|
+
compareDirectories(outputPath);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('Toc root merge on non root dir', async () => {
|
|
53
|
+
const {inputPath, outputPath} = getTestPaths('mocks/include-toc/test7');
|
|
54
|
+
await cliTestAdapter.testPass(inputPath, outputPath);
|
|
55
|
+
compareDirectories(outputPath);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
4
|
+
|
|
5
|
+
const generateMapTestTemplate = (
|
|
6
|
+
testTitle: string,
|
|
7
|
+
testRootPath: string,
|
|
8
|
+
{md2md = true, md2html = true, args = '--allow-custom-resources'},
|
|
9
|
+
) => {
|
|
10
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
11
|
+
|
|
12
|
+
test(testTitle, async () => {
|
|
13
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
14
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md, md2html, args});
|
|
15
|
+
compareDirectories(outputPath);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe('Allow load custom resources', () => {
|
|
20
|
+
generateMapTestTemplate(
|
|
21
|
+
'md2md with custom resources',
|
|
22
|
+
'mocks/load-custom-resources/md2md-with-resources',
|
|
23
|
+
{md2html: false},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
generateMapTestTemplate(
|
|
27
|
+
'md2html with custom resources',
|
|
28
|
+
'mocks/load-custom-resources/md2html-with-resources',
|
|
29
|
+
{md2md: false},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
generateMapTestTemplate(
|
|
33
|
+
'md2html single page with custom resources',
|
|
34
|
+
'mocks/load-custom-resources/single-page-with-resources',
|
|
35
|
+
{md2md: false, args: '--allow-custom-resources --single-page'},
|
|
36
|
+
);
|
|
37
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
4
|
+
|
|
5
|
+
const generateMapTestTemplate = (
|
|
6
|
+
testTitle: string,
|
|
7
|
+
testRootPath: string,
|
|
8
|
+
{md2md = true, md2html = true},
|
|
9
|
+
) => {
|
|
10
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
11
|
+
|
|
12
|
+
test(testTitle, async () => {
|
|
13
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
14
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md, md2html});
|
|
15
|
+
compareDirectories(outputPath);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe('Allow load custom resources', () => {
|
|
20
|
+
generateMapTestTemplate('md2md with metadata', 'mocks/metadata/md2md-with-metadata', {
|
|
21
|
+
md2html: false,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
generateMapTestTemplate('md2html with metadata', 'mocks/metadata/md2html-with-metadata', {
|
|
25
|
+
md2md: false,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
4
|
+
|
|
5
|
+
describe('plugin corner cases:', () => {
|
|
6
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
7
|
+
|
|
8
|
+
it('images in deflists — integrity check', async () => {
|
|
9
|
+
const {inputPath, outputPath} = getTestPaths(
|
|
10
|
+
'mocks/plugin-corner-cases/images-in-deflists',
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md: true, md2html: false});
|
|
14
|
+
compareDirectories(outputPath);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {describe, it} from 'vitest';
|
|
2
|
+
import {dedent} from 'ts-dedent';
|
|
3
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
4
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
5
|
+
|
|
6
|
+
function test(_description: string) {
|
|
7
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
8
|
+
|
|
9
|
+
it('internal', async () => {
|
|
10
|
+
const {inputPath, outputPath} = getTestPaths('mocks/regression');
|
|
11
|
+
|
|
12
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md: true, md2html: false});
|
|
13
|
+
await cliTestAdapter.testPass(outputPath, outputPath + '-html', {
|
|
14
|
+
md2md: false,
|
|
15
|
+
md2html: true,
|
|
16
|
+
});
|
|
17
|
+
await cliTestAdapter.testPass(outputPath, outputPath + '-static-html', {
|
|
18
|
+
md2md: false,
|
|
19
|
+
md2html: true,
|
|
20
|
+
args: '--static-content',
|
|
21
|
+
});
|
|
22
|
+
compareDirectories(outputPath);
|
|
23
|
+
compareDirectories(outputPath + '-html');
|
|
24
|
+
// compareDirectories(outputPath + '-static-html');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('Regression', () => {
|
|
29
|
+
test(dedent`
|
|
30
|
+
- not_var liquid syntax
|
|
31
|
+
- normalize leading hrefs
|
|
32
|
+
- empty href in toc item
|
|
33
|
+
`);
|
|
34
|
+
});
|
package/e2e/rtl.spec.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
import {compareDirectories, getTestPaths} from '../fixtures';
|
|
3
|
+
import {CliTestAdapter} from '../fixtures/cliAdapter';
|
|
4
|
+
|
|
5
|
+
const generateMapTestTemplate = (
|
|
6
|
+
testTitle: string,
|
|
7
|
+
testRootPath: string,
|
|
8
|
+
{md2md = true, md2html = true, args = '--allow-custom-resources'},
|
|
9
|
+
) => {
|
|
10
|
+
const cliTestAdapter = new CliTestAdapter();
|
|
11
|
+
|
|
12
|
+
test(testTitle, async () => {
|
|
13
|
+
const {inputPath, outputPath} = getTestPaths(testRootPath);
|
|
14
|
+
await cliTestAdapter.testPass(inputPath, outputPath, {md2md, md2html, args});
|
|
15
|
+
compareDirectories(outputPath);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe('Generate html document with correct lang and dir attributes. Load correct bundles.', () => {
|
|
20
|
+
generateMapTestTemplate(
|
|
21
|
+
'documentation with rtl and ltr langs',
|
|
22
|
+
'mocks/rtl/multidirectional-languages',
|
|
23
|
+
{md2html: true, md2md: false},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
generateMapTestTemplate('documentation with only one rtl lang', 'mocks/rtl/rtl-language', {
|
|
27
|
+
md2html: true,
|
|
28
|
+
md2md: false,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {Runner, createRunner} from './runners';
|
|
2
|
+
import {cleanupDirectory} from './utils/file';
|
|
3
|
+
|
|
4
|
+
export interface TestRunArgs {
|
|
5
|
+
md2md?: boolean;
|
|
6
|
+
md2html?: boolean;
|
|
7
|
+
args?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class CliTestAdapter {
|
|
11
|
+
private readonly runner: Runner = createRunner();
|
|
12
|
+
|
|
13
|
+
async testPass(
|
|
14
|
+
inputPath: string,
|
|
15
|
+
outputPath: string,
|
|
16
|
+
{md2md = true, md2html = true, args = ''}: TestRunArgs = {},
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
cleanupDirectory(outputPath);
|
|
19
|
+
|
|
20
|
+
const baseArgs = [
|
|
21
|
+
'--input',
|
|
22
|
+
inputPath,
|
|
23
|
+
'--quiet',
|
|
24
|
+
'--allowHTML',
|
|
25
|
+
...args.split(' ').filter(Boolean),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
if (md2md && md2html) {
|
|
29
|
+
cleanupDirectory(`${outputPath}-html`);
|
|
30
|
+
|
|
31
|
+
await this.runner.runYfmDocs([...baseArgs, '--output', outputPath, '-f', 'md']);
|
|
32
|
+
await this.runner.runYfmDocs([...baseArgs, '--output', `${outputPath}-html`, '-f', 'html']);
|
|
33
|
+
} else if (md2md) {
|
|
34
|
+
await this.runner.runYfmDocs([...baseArgs, '--output', outputPath, '-f', 'md']);
|
|
35
|
+
} else {
|
|
36
|
+
await this.runner.runYfmDocs([...baseArgs, '--output', outputPath]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|