@@ -86,7 +86,6 @@ describe('permalink', () => {
86
86
describe ( 'markdown page' , ( ) => {
87
87
test ( 'should be able to pointing to a markdown file' , async ( ) => {
88
88
const { relative, filePath } = getDocument ( 'README.md' )
89
- console . log ( 'relative' , relative )
90
89
const markdown = getMarkdown ( )
91
90
const page = await setupPage ( { filePath, relative } , { markdown } )
92
91
@@ -116,6 +115,30 @@ describe('markdown page', () => {
116
115
} )
117
116
} )
118
117
118
+ describe ( 'title' , ( ) => {
119
+ test ( 'should be able to set title' , async ( ) => {
120
+ const title = 'VuePress'
121
+ const page = await setupPage ( { path : '/' , title } )
122
+ expect ( page . title ) . toBe ( title )
123
+ } )
124
+
125
+ test ( 'should set title from frontmatter' , async ( ) => {
126
+ const title = 'VuePress Alpha' // from fixture
127
+ const { relative, filePath } = getDocument ( 'alpha.md' )
128
+ const markdown = getMarkdown ( )
129
+ const page = await setupPage ( { filePath, relative } , { markdown } )
130
+ expect ( page . title ) . toBe ( title )
131
+ } )
132
+
133
+ test ( 'should use first header in markdown to set title ' , async ( ) => {
134
+ const title = 'Home' // from fixture
135
+ const { relative, filePath } = getDocument ( 'README.md' )
136
+ const markdown = getMarkdown ( )
137
+ const page = await setupPage ( { filePath, relative } , { markdown } )
138
+ expect ( page . title ) . toBe ( title )
139
+ } )
140
+ } )
141
+
119
142
describe ( 'enhancer' , ( ) => {
120
143
test ( 'should loop over sync enhancers' , async ( ) => {
121
144
const page = await setupPage ( { path : '/' } )
@@ -172,7 +195,6 @@ describe('enhancer', () => {
172
195
} )
173
196
174
197
// TODO permalink - driven by global pattern
175
- // TODO Title
176
198
// TODO I18n
177
199
// TODO Meta
178
200
// TODO Add a page with explicit content
0 commit comments