File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
packages/@vuepress/core/lib/node/__tests__/prepare Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,21 @@ describe('permalink', () => {
8181 expect ( page . path ) . toBe ( '/permalink/' )
8282 expect ( page . regularPath ) . toBe ( '/' )
8383 } )
84+
85+ test ( 'should be able to set permalink from global pattern' , async ( ) => {
86+ const permalinkPattern = '/:year/:month/:day/:slug'
87+ const { relative, filePath } = getDocument ( '2020-01-01-date.md' )
88+ const markdown = getMarkdown ( )
89+ const page = await setupPage ( { filePath, relative, permalinkPattern } , { markdown } )
90+ expect ( page . path ) . toBe ( '/2020/01/01/date/' )
91+ expect ( page . regularPath ) . toBe ( '/2020-01-01-date.html' )
92+
93+ const pageWithLocalePath = await setupPage (
94+ { filePath, relative, permalinkPattern } ,
95+ { computed : { setPage ( ) { } , $localePath : '/zh/' } , markdown }
96+ )
97+ expect ( pageWithLocalePath . path ) . toBe ( '/zh/2020/01/01/date/' )
98+ } )
8499} )
85100
86101describe ( 'markdown page' , ( ) => {
@@ -282,7 +297,3 @@ describe('public api', () => {
282297 } )
283298} )
284299
285- // TODO permalink - driven by global pattern
286- // TODO I18n
287- // TODO SFC
288-
You can’t perform that action at this time.
0 commit comments