@diplodoc/cli-tests 5.39.1 → 5.39.3
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/e2e/__snapshots__/includes-conditions.test.ts.snap +92 -0
- package/e2e/includes-conditions.test.ts +23 -0
- package/mocks/includes-conditions/input/includes/first.md +5 -0
- package/mocks/includes-conditions/input/includes/second.md +5 -0
- package/mocks/includes-conditions/input/includes/third.md +1 -0
- package/mocks/includes-conditions/input/index.md +7 -0
- package/mocks/includes-conditions/input/presets.yaml +2 -0
- package/mocks/includes-conditions/input/toc.yaml +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle > filelist 1`] = `
|
|
4
|
+
"[
|
|
5
|
+
"includes/first-hash.md",
|
|
6
|
+
"includes/second-hash.md",
|
|
7
|
+
"includes/third-hash.md",
|
|
8
|
+
"index.md",
|
|
9
|
+
"toc.yaml"
|
|
10
|
+
]"
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle > filelist 2`] = `
|
|
14
|
+
"[
|
|
15
|
+
"index.html",
|
|
16
|
+
"toc.js"
|
|
17
|
+
]"
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 1`] = `
|
|
21
|
+
"{% note info %}
|
|
22
|
+
|
|
23
|
+
This is the first include.
|
|
24
|
+
|
|
25
|
+
{% endnote %}
|
|
26
|
+
"
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 2`] = `
|
|
30
|
+
"
|
|
31
|
+
"
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 3`] = `
|
|
35
|
+
"This is the third include.
|
|
36
|
+
"
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 4`] = `
|
|
40
|
+
"---
|
|
41
|
+
metadata:
|
|
42
|
+
- name: generator
|
|
43
|
+
content: Diplodoc Platform vDIPLODOC-VERSION
|
|
44
|
+
vcsPath: index.md
|
|
45
|
+
---
|
|
46
|
+
# Test Includes Conditions
|
|
47
|
+
|
|
48
|
+
{% include [first](includes/first-hash.md) %}
|
|
49
|
+
|
|
50
|
+
{% include [second](includes/second-hash.md) %}
|
|
51
|
+
|
|
52
|
+
{% include [third](includes/third-hash.md) %}
|
|
53
|
+
"
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 5`] = `
|
|
57
|
+
"items:
|
|
58
|
+
- name: Test Includes Conditions
|
|
59
|
+
href: index.md
|
|
60
|
+
path: toc.yaml
|
|
61
|
+
"
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 6`] = `
|
|
65
|
+
"<!DOCTYPE html>
|
|
66
|
+
<html lang="ru" dir="ltr">
|
|
67
|
+
<head>
|
|
68
|
+
<meta charset="utf-8">
|
|
69
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
70
|
+
<base href="./" />
|
|
71
|
+
<title>Test Includes Conditions</title>
|
|
72
|
+
<meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
|
|
73
|
+
<style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
|
|
74
|
+
</head>
|
|
75
|
+
<body class="g-root g-root_theme_light">
|
|
76
|
+
<div id="root"></div>
|
|
77
|
+
<script type="application/json" id="diplodoc-state">
|
|
78
|
+
{"data":{"leading":false,"html":"<div class=\\"yfm-note yfm-accent-info\\" note-type=\\"info\\"><p class=\\"yfm-note-title\\">Примечание</p>/n<div class=\\"yfm-note-content\\"><p>This is the first include.</p>/n</div></div><p>This is the third include.</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Test Includes Conditions"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
79
|
+
</script>
|
|
80
|
+
<script type="application/javascript">
|
|
81
|
+
const data = document.querySelector('script#diplodoc-state');
|
|
82
|
+
window.__DATA__ = JSON.parse((function unescape(string) {
|
|
83
|
+
return string.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
84
|
+
})(data.innerText));
|
|
85
|
+
window.STATIC_CONTENT = false;
|
|
86
|
+
</script>
|
|
87
|
+
<script type="application/javascript" defer src="toc.js"></script>
|
|
88
|
+
</body>
|
|
89
|
+
</html>"
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
exports[`Includes with conditions > Consecutive includes with false condition in the middle 7`] = `"window.__DATA__.data.toc = {"items":[{"name":"Test Includes Conditions","href":"index.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {describe, test} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
4
|
+
|
|
5
|
+
describe('Includes with conditions', () => {
|
|
6
|
+
test('Consecutive includes with false condition in the middle', async () => {
|
|
7
|
+
const {inputPath, outputPath} = getTestPaths('mocks/includes-conditions');
|
|
8
|
+
|
|
9
|
+
// Test md2md transformation
|
|
10
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
11
|
+
md2md: true,
|
|
12
|
+
md2html: false,
|
|
13
|
+
});
|
|
14
|
+
await compareDirectories(outputPath);
|
|
15
|
+
|
|
16
|
+
// Test md2html transformation
|
|
17
|
+
await TestAdapter.testBuildPass(outputPath, outputPath + '-html', {
|
|
18
|
+
md2md: false,
|
|
19
|
+
md2html: true,
|
|
20
|
+
});
|
|
21
|
+
await compareDirectories(outputPath + '-html');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This is the third include.
|