@diplodoc/cli-tests 5.20.1 → 5.22.0
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__/{conditions.spec.ts.snap → vars-conditions.spec.ts.snap} +10 -10
- package/e2e/themer.test.ts +174 -0
- package/e2e/{conditions.spec.ts → vars-conditions.spec.ts} +3 -3
- package/mocks/themer/test1/input/.yfm +3 -0
- package/mocks/themer/test1/input/_assets/style/custom.css +3 -0
- package/mocks/themer/test1/input/index.md +1 -0
- package/mocks/themer/test1/input/theme.yaml +14 -0
- package/mocks/themer/test1/input/toc.yaml +3 -0
- package/mocks/themer/test2/input/index.md +1 -0
- package/mocks/themer/test2/input/theme.yaml +8 -0
- package/mocks/themer/test2/input/toc.yaml +3 -0
- package/mocks/themer/test3/input/index.md +1 -0
- package/mocks/themer/test3/input/toc.yaml +3 -0
- package/mocks/themer/test4/input/index.md +1 -0
- package/mocks/themer/test4/input/theme.yaml +3 -0
- package/mocks/themer/test4/input/toc.yaml +3 -0
- package/mocks/vars-conditions/input/index.md +3 -0
- package/mocks/{conditions → vars-conditions}/input/page1.yaml +3 -4
- package/mocks/{conditions → vars-conditions}/input/page2.md +3 -1
- package/mocks/vars-conditions/input/presets.yaml +9 -0
- package/mocks/{conditions → vars-conditions}/input/toc.yaml +7 -0
- package/package.json +1 -1
- package/mocks/conditions/input/index.md +0 -1
- package/mocks/conditions/input/presets.yaml +0 -4
- /package/mocks/{conditions → vars-conditions}/input/.yfm +0 -0
- /package/mocks/{conditions → vars-conditions}/input/page3.md +0 -0
- /package/mocks/{conditions → vars-conditions}/input/page4.md +0 -0
- /package/mocks/{conditions → vars-conditions}/input/page5.yaml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`
|
|
3
|
+
exports[`Vars and conditions > Vars and conditions > filelist 1`] = `
|
|
4
4
|
"[
|
|
5
5
|
".yfm",
|
|
6
6
|
"index.html",
|
|
@@ -11,12 +11,12 @@ exports[`Conditions > Conditions > filelist 1`] = `
|
|
|
11
11
|
]"
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
|
-
exports[`
|
|
14
|
+
exports[`Vars and conditions > Vars and conditions 1`] = `
|
|
15
15
|
"allowHTML: true
|
|
16
16
|
"
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
exports[`
|
|
19
|
+
exports[`Vars and conditions > Vars and conditions 2`] = `
|
|
20
20
|
"<!DOCTYPE html>
|
|
21
21
|
<html lang="ru" dir="ltr">
|
|
22
22
|
<head>
|
|
@@ -30,7 +30,7 @@ exports[`Conditions > Conditions 2`] = `
|
|
|
30
30
|
<body class="g-root g-root_theme_light">
|
|
31
31
|
<div id="root"></div>
|
|
32
32
|
<script type="application/json" id="diplodoc-state">
|
|
33
|
-
{"data":{"leading":false,"html":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Index page"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
33
|
+
{"data":{"leading":false,"html":"<p>Контент из переменной</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"index.md"},"headings":[],"title":"Index page"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
34
34
|
</script>
|
|
35
35
|
<script type="application/javascript">
|
|
36
36
|
const data = document.querySelector('script#diplodoc-state');
|
|
@@ -44,7 +44,7 @@ exports[`Conditions > Conditions 2`] = `
|
|
|
44
44
|
</html>"
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
exports[`
|
|
47
|
+
exports[`Vars and conditions > Vars and conditions 3`] = `
|
|
48
48
|
"<!DOCTYPE html>
|
|
49
49
|
<html lang="ru" dir="ltr">
|
|
50
50
|
<head>
|
|
@@ -58,7 +58,7 @@ exports[`Conditions > Conditions 3`] = `
|
|
|
58
58
|
<body class="g-root g-root_theme_light">
|
|
59
59
|
<div id="root"></div>
|
|
60
60
|
<script type="application/json" id="diplodoc-state">
|
|
61
|
-
{"data":{"leading":true,"data":{"blocks":[{"type":"header-block","title":"<p>
|
|
61
|
+
{"data":{"leading":true,"data":{"blocks":[{"type":"header-block","title":"<p>Тестовая страница</p>/n","description":"<p>Description: aboba</p>/n"}],"links":[]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"vcsPath":"page1.yaml"},"title":""},"router":{"pathname":"page1","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
62
62
|
</script>
|
|
63
63
|
<script type="application/javascript">
|
|
64
64
|
const data = document.querySelector('script#diplodoc-state');
|
|
@@ -72,7 +72,7 @@ exports[`Conditions > Conditions 3`] = `
|
|
|
72
72
|
</html>"
|
|
73
73
|
`;
|
|
74
74
|
|
|
75
|
-
exports[`
|
|
75
|
+
exports[`Vars and conditions > Vars and conditions 4`] = `
|
|
76
76
|
"<!DOCTYPE html>
|
|
77
77
|
<html lang="ru" dir="ltr">
|
|
78
78
|
<head>
|
|
@@ -86,7 +86,7 @@ exports[`Conditions > Conditions 4`] = `
|
|
|
86
86
|
<body class="g-root g-root_theme_light">
|
|
87
87
|
<div id="root"></div>
|
|
88
88
|
<script type="application/json" id="diplodoc-state">
|
|
89
|
-
{"data":{"leading":false,"html":"<div class=\\"yfm-page-constructor\\" data-content-encoded=\\"%7B%22blocks%22%3A%5B%7B%22type%22%3A%22header-block%22%2C%22title%22%3A%22%3Cp%3EWhen%202%3C%2Fp%3E%5Cn%22%2C%22description%22%3A%22%3Cp%3E%D0%A2%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%B7%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA%20%D0%B4%D0%BB%D1%8F%20%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B8%20when%202%3C%2Fp%3E%5Cn%22%7D%5D%7D\\" data-hydrated=\\"false\\"><div class=\\"g-root g-root_theme_light pc-page-constructor\\"><div class=\\"pc-page-constructor__wrapper\\"><div class=\\"pc-layout\\"><main class=\\"pc-layout__content\\"><header class=\\"pc-header-block pc-header-block_media-view_full pc-header-block_controls-view_light\\"><div class=\\"pc-Grid pc-header-block\\"><div class=\\"container-fluid pc-header-block__container-fluid\\"><div class=\\"row\\"><div class=\\"col col-reset pc-header-block__content-wrapper\\"><div class=\\"row\\"><div class=\\"col pc-header-block__content pc-header-block__content_offset_default pc-header-block__content_theme_light pc-header-block__content_vertical-offset_m\\"><div class=\\"col col-lg-8 col-md-8 col-sm-12 col-12 pc-header-block__content-inner\\"><h1 class=\\"pc-header-block__title-container\\"><div class=\\"yfm yfm_constructor yfm_constructor_theme_light pc-header-block__title\\"><p>When 2</p>/n</div></h1><div class=\\"pc-header-block__description pc-header-block__description_theme_light\\"><span class=\\"yfm yfm_constructor yfm_constructor_theme_light\\"><p>Тестовый заголовок для проверки when 2</p>/n</span></div></div></div></div></div></div></div></div></header><div class=\\"pc-Grid\\"><div class=\\"container-fluid \\"><div class=\\"row pc-constructor-row\\"><div class=\\"col\\"></div></div></div></div></main></div></div></div></div><h1>Page 2</h1>/n<p></p>/n<p></p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_bundle/page-constructor-extension.css"],"script":["_bundle/page-constructor-extension.js"],"vcsPath":"page2.md"},"headings":[],"title":""},"router":{"pathname":"page2","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
89
|
+
{"data":{"leading":false,"html":"<div class=\\"yfm-page-constructor\\" data-content-encoded=\\"%7B%22blocks%22%3A%5B%7B%22type%22%3A%22header-block%22%2C%22title%22%3A%22%3Cp%3EWhen%202%3C%2Fp%3E%5Cn%22%2C%22description%22%3A%22%3Cp%3E%D0%A2%D0%B5%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%B7%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA%20%D0%B4%D0%BB%D1%8F%20%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B8%20when%202%3C%2Fp%3E%5Cn%22%7D%5D%7D\\" data-hydrated=\\"false\\"><div class=\\"g-root g-root_theme_light pc-page-constructor\\"><div class=\\"pc-page-constructor__wrapper\\"><div class=\\"pc-layout\\"><main class=\\"pc-layout__content\\"><header class=\\"pc-header-block pc-header-block_media-view_full pc-header-block_controls-view_light\\"><div class=\\"pc-Grid pc-header-block\\"><div class=\\"container-fluid pc-header-block__container-fluid\\"><div class=\\"row\\"><div class=\\"col col-reset pc-header-block__content-wrapper\\"><div class=\\"row\\"><div class=\\"col pc-header-block__content pc-header-block__content_offset_default pc-header-block__content_theme_light pc-header-block__content_vertical-offset_m\\"><div class=\\"col col-lg-8 col-md-8 col-sm-12 col-12 pc-header-block__content-inner\\"><h1 class=\\"pc-header-block__title-container\\"><div class=\\"yfm yfm_constructor yfm_constructor_theme_light pc-header-block__title\\"><p>When 2</p>/n</div></h1><div class=\\"pc-header-block__description pc-header-block__description_theme_light\\"><span class=\\"yfm yfm_constructor yfm_constructor_theme_light\\"><p>Тестовый заголовок для проверки when 2</p>/n</span></div></div></div></div></div></div></div></div></header><div class=\\"pc-Grid\\"><div class=\\"container-fluid \\"><div class=\\"row pc-constructor-row\\"><div class=\\"col\\"></div></div></div></div></main></div></div></div></div><h1>Page 2</h1>/n<p></p>/n<p></p>/n<p>Документация</p>/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_bundle/page-constructor-extension.css"],"script":["_bundle/page-constructor-extension.js"],"vcsPath":"page2.md"},"headings":[],"title":""},"router":{"pathname":"page2","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
|
|
90
90
|
</script>
|
|
91
91
|
<script type="application/javascript">
|
|
92
92
|
const data = document.querySelector('script#diplodoc-state');
|
|
@@ -100,7 +100,7 @@ exports[`Conditions > Conditions 4`] = `
|
|
|
100
100
|
</html>"
|
|
101
101
|
`;
|
|
102
102
|
|
|
103
|
-
exports[`
|
|
103
|
+
exports[`Vars and conditions > Vars and conditions 5`] = `
|
|
104
104
|
"<!DOCTYPE html>
|
|
105
105
|
<html lang="ru" dir="ltr">
|
|
106
106
|
<head>
|
|
@@ -128,4 +128,4 @@ exports[`Conditions > Conditions 5`] = `
|
|
|
128
128
|
</html>"
|
|
129
129
|
`;
|
|
130
130
|
|
|
131
|
-
exports[`
|
|
131
|
+
exports[`Vars and conditions > Vars and conditions 6`] = `"window.__DATA__.data.toc = {"title":"Conditions","href":"index.html","navigation":{"logo":{"url":"./"},"header":{"leftItems":[{"text":"Always visible","type":"link","url":"./index.md"},{"text":"Visible when var2 is true","type":"link","url":"./page2.md"},{"text":"Документация","type":"link","url":"./docs.md","urlTitle":"Перейти на главную"}],"rightItems":[{"type":"controls"},{"text":"Link to aboba","type":"link","url":"./page1.yaml"}]}},"items":[{"name":"Page 1","href":"page1.html","id":"UUID"},{"name":"Page 2","href":"page2.html","id":"UUID"},{"name":"Page 5","href":"page5.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest';
|
|
2
|
+
import {existsSync} from 'node:fs';
|
|
3
|
+
import {readFile} from 'node:fs/promises';
|
|
4
|
+
import {join} from 'node:path';
|
|
5
|
+
|
|
6
|
+
import {TestAdapter, getTestPaths} from '../fixtures';
|
|
7
|
+
|
|
8
|
+
describe('Build themer feature', () => {
|
|
9
|
+
it.each([
|
|
10
|
+
['md2md', true, false],
|
|
11
|
+
['md2html', false, true],
|
|
12
|
+
])('generates theme.css from theme.yaml (%s)', async (_, md2md, md2html) => {
|
|
13
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test1');
|
|
14
|
+
|
|
15
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
16
|
+
md2md,
|
|
17
|
+
md2html,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const cssPath = join(outputPath, '_assets', 'style', 'theme.css');
|
|
21
|
+
const css = await readFile(cssPath, 'utf8');
|
|
22
|
+
|
|
23
|
+
expect(css).toContain('--g-color-base-brand: var(--g-color-private-base-brand-550-solid);');
|
|
24
|
+
expect(css).toContain('--g-color-private-base-brand-550-solid: rgb(255 0 0);');
|
|
25
|
+
expect(css).toContain('--g-color-private-base-brand-600-solid: rgb(255 25 25);');
|
|
26
|
+
expect(css).toContain('--yfm-color-link: green;');
|
|
27
|
+
expect(css).toContain('--yfm-color-link: blue;');
|
|
28
|
+
expect(css).toContain('--g-color-base-selection: rgb(255 0 255);');
|
|
29
|
+
expect(css).toContain('--g-color-base-background: hsl(60 100% 50%);');
|
|
30
|
+
expect(css).toContain('--g-color-base-background: rgba(255, 165, 0, 1);');
|
|
31
|
+
expect(css).toContain('--g-color-base-selection: hsla(0 0% 50% / 1);');
|
|
32
|
+
expect(css).toContain('--yfm-color-note-info-background: red;');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it.each([
|
|
36
|
+
['md2md', true, false],
|
|
37
|
+
['md2html', false, true],
|
|
38
|
+
])('generates theme.css with theme.yaml and flag value (%s)', async (_, md2md, md2html) => {
|
|
39
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test1');
|
|
40
|
+
|
|
41
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
42
|
+
md2md,
|
|
43
|
+
md2html,
|
|
44
|
+
args: '--theme pink',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const cssPath = join(outputPath, '_assets', 'style', 'theme.css');
|
|
48
|
+
const css = await readFile(cssPath, 'utf8');
|
|
49
|
+
|
|
50
|
+
expect(css).toContain('--g-color-base-brand: var(--g-color-private-base-brand-550-solid);');
|
|
51
|
+
expect(css).toContain('--g-color-private-base-brand-550-solid: rgb(255 192 203);');
|
|
52
|
+
expect(css).toContain('--g-color-private-base-brand-600-solid: rgb(234 177 188);');
|
|
53
|
+
expect(css).toContain('--yfm-color-link: green;');
|
|
54
|
+
expect(css).toContain('--yfm-color-link: blue;');
|
|
55
|
+
expect(css).toContain('--g-color-base-selection: rgb(255 0 255);');
|
|
56
|
+
expect(css).toContain('--g-color-base-background: hsl(60 100% 50%);');
|
|
57
|
+
expect(css).toContain('--g-color-base-background: rgba(255, 165, 0, 1);');
|
|
58
|
+
expect(css).toContain('--g-color-base-selection: hsla(0 0% 50% / 1);');
|
|
59
|
+
expect(css).toContain('--yfm-color-note-info-background: red;');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it.each([
|
|
63
|
+
['md2md', true, false],
|
|
64
|
+
['md2html', false, true],
|
|
65
|
+
])('generates theme.css from flag value only (%s)', async (_, md2md, md2html) => {
|
|
66
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test3');
|
|
67
|
+
|
|
68
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
69
|
+
md2md,
|
|
70
|
+
md2html,
|
|
71
|
+
args: '--theme pink',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const cssPath = join(outputPath, '_assets', 'style', 'theme.css');
|
|
75
|
+
const css = await readFile(cssPath, 'utf8');
|
|
76
|
+
|
|
77
|
+
expect(existsSync(join(inputPath, 'theme.yaml'))).toBe(false);
|
|
78
|
+
expect(css).toContain('--g-color-base-brand: var(--g-color-private-base-brand-550-solid);');
|
|
79
|
+
expect(css).toContain('--g-color-private-base-brand-550-solid: rgb(255 192 203);');
|
|
80
|
+
expect(css).toContain('--g-color-private-base-brand-600-solid: rgb(234 177 188);');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('custom styles override theme colors', async () => {
|
|
84
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test1');
|
|
85
|
+
|
|
86
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
87
|
+
md2md: false,
|
|
88
|
+
md2html: true,
|
|
89
|
+
args: '--allow-custom-resources true',
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const htmlPath = join(outputPath, 'index.html');
|
|
93
|
+
const html = await readFile(htmlPath, 'utf8');
|
|
94
|
+
|
|
95
|
+
const themeIndex = html.indexOf('_assets/style/theme.css');
|
|
96
|
+
const customIndex = html.indexOf('_assets/style/custom.css');
|
|
97
|
+
expect(customIndex).toBeGreaterThan(themeIndex);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('does not generates theme.css if not theme.yaml and flag', async () => {
|
|
101
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test3');
|
|
102
|
+
|
|
103
|
+
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
104
|
+
md2md: false,
|
|
105
|
+
md2html: true,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const htmlPath = join(outputPath, 'index.html');
|
|
109
|
+
const html = await readFile(htmlPath, 'utf8');
|
|
110
|
+
|
|
111
|
+
const themeIndex = html.indexOf('_assets/style/theme.css');
|
|
112
|
+
expect(themeIndex).toBe(-1);
|
|
113
|
+
|
|
114
|
+
const themePath = join(outputPath, '_assets', 'style', 'theme.css');
|
|
115
|
+
expect(existsSync(themePath)).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it.each([
|
|
119
|
+
['md2md', 'md'],
|
|
120
|
+
['md2html', 'html'],
|
|
121
|
+
])('includes errors for invalid colors from theme.yaml and flag (%s)', async (_, format) => {
|
|
122
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test2');
|
|
123
|
+
|
|
124
|
+
const report = await TestAdapter.build.run(inputPath, outputPath, [
|
|
125
|
+
'-f',
|
|
126
|
+
format,
|
|
127
|
+
'--theme',
|
|
128
|
+
'pinkk',
|
|
129
|
+
]);
|
|
130
|
+
|
|
131
|
+
expect(report.code).toBe(1);
|
|
132
|
+
expect(report.errors.includes('ERR Invalid color: "pinkk"')).toBe(true);
|
|
133
|
+
expect(report.errors.includes('ERR Invalid color: "redd"')).toBe(true);
|
|
134
|
+
expect(report.errors.includes('ERR /dark/link must be string')).toBe(true);
|
|
135
|
+
expect(report.errors.includes('ERR Invalid color: "5"')).toBe(true);
|
|
136
|
+
expect(report.errors.includes('ERR Invalid color: ""')).toBe(true);
|
|
137
|
+
expect(report.errors.includes('ERR Invalid color: " "')).toBe(true);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it.each([
|
|
141
|
+
['md2md', 'md'],
|
|
142
|
+
['md2html', 'html'],
|
|
143
|
+
])('warns about unknown color keys in theme.yaml (%s)', async (_, format) => {
|
|
144
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test1');
|
|
145
|
+
|
|
146
|
+
const report = await TestAdapter.build.run(inputPath, outputPath, ['-f', format]);
|
|
147
|
+
|
|
148
|
+
expect(report.code).toBe(0);
|
|
149
|
+
expect(
|
|
150
|
+
report.warns.includes(
|
|
151
|
+
'WARN File theme.yaml must NOT have additional properties "base-brandd"',
|
|
152
|
+
),
|
|
153
|
+
).toBe(true);
|
|
154
|
+
expect(
|
|
155
|
+
report.warns.includes('WARN /dark must NOT have additional properties "unknown-color"'),
|
|
156
|
+
).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it.each([
|
|
160
|
+
['md2md', 'md'],
|
|
161
|
+
['md2html', 'html'],
|
|
162
|
+
])('includes errors for invalid syntax in theme.yaml (%s)', async (_, format) => {
|
|
163
|
+
const {inputPath, outputPath} = getTestPaths('mocks/themer/test4');
|
|
164
|
+
|
|
165
|
+
const report = await TestAdapter.build.run(inputPath, outputPath, ['-f', format]);
|
|
166
|
+
|
|
167
|
+
expect(report.code).toBe(1);
|
|
168
|
+
expect(
|
|
169
|
+
report.errors.includes(
|
|
170
|
+
'ERR Failed to generate theme: YAMLException: bad indentation of a mapping entry (3:5)',
|
|
171
|
+
),
|
|
172
|
+
).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
@@ -2,9 +2,9 @@ import {describe, it} from 'vitest';
|
|
|
2
2
|
|
|
3
3
|
import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
|
|
4
4
|
|
|
5
|
-
describe('
|
|
6
|
-
it('
|
|
7
|
-
const {inputPath, outputPath} = getTestPaths('mocks/conditions');
|
|
5
|
+
describe('Vars and conditions', () => {
|
|
6
|
+
it('Vars and conditions', async () => {
|
|
7
|
+
const {inputPath, outputPath} = getTestPaths('mocks/vars-conditions');
|
|
8
8
|
|
|
9
9
|
await TestAdapter.testBuildPass(inputPath, outputPath, {
|
|
10
10
|
md2md: false,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Test for themer
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
base-brand: red
|
|
2
|
+
link: green
|
|
3
|
+
note-info-background: red
|
|
4
|
+
base-brandd: red
|
|
5
|
+
base-selection: rgb(255 0 255)
|
|
6
|
+
|
|
7
|
+
dark:
|
|
8
|
+
link: blue
|
|
9
|
+
unknown-color: blue
|
|
10
|
+
base-background: hsl(60 100% 50%)
|
|
11
|
+
|
|
12
|
+
light:
|
|
13
|
+
base-background: rgba(255, 165, 0, 1)
|
|
14
|
+
base-selection: hsla(0 0% 50% / 1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Test for themer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Test for themer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Test for themer
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
blocks:
|
|
2
2
|
- type: header-block
|
|
3
|
-
title: '
|
|
4
|
-
description: 'Description
|
|
3
|
+
title: '{{page_title}}'
|
|
4
|
+
description: 'Description: {{var1}}'
|
|
5
5
|
when: var3 >= 1
|
|
6
6
|
- type: header-block
|
|
7
7
|
title: When 1
|
|
@@ -10,5 +10,4 @@ blocks:
|
|
|
10
10
|
- type: header-block
|
|
11
11
|
title: Test title
|
|
12
12
|
description: 'Test description'
|
|
13
|
-
when: var3 < 1
|
|
14
|
-
|
|
13
|
+
when: var3 < 1
|
|
@@ -20,12 +20,19 @@ navigation:
|
|
|
20
20
|
type: "link"
|
|
21
21
|
url: "./page4.md"
|
|
22
22
|
when: var3 > 1
|
|
23
|
+
- text: "{{nav_text}}"
|
|
24
|
+
type: "link"
|
|
25
|
+
url: "./{{nav_page}}.md"
|
|
26
|
+
urlTitle: "{{nav_title}}"
|
|
23
27
|
rightItems:
|
|
24
28
|
- type: controls
|
|
25
29
|
- text: "Hidden control"
|
|
26
30
|
type: "link"
|
|
27
31
|
url: "./hidden.md"
|
|
28
32
|
when: var1 == 'not_aboba'
|
|
33
|
+
- text: "Link to {{var1}}"
|
|
34
|
+
type: "link"
|
|
35
|
+
url: "./page1.yaml"
|
|
29
36
|
|
|
30
37
|
items:
|
|
31
38
|
- name: Page 1
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Index page
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|