@@ -9,6 +9,7 @@ test('should update head correctly', async ({ page }) => {
99 const bazLocator = page . locator ( 'head meta[name="baz"]' )
1010 const fooEnLocator = page . locator ( 'head meta[name="foo-en"]' )
1111 const fooZhLocator = page . locator ( 'head meta[name="foo-zh"]' )
12+ const fooChsLocator = page . locator ( 'head meta[name="foo-中文"]' )
1213
1314 // en-US
1415 await page . goto ( '' )
@@ -36,6 +37,8 @@ test('should update head correctly', async ({ page }) => {
3637 await expect ( bazLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foobar baz' )
3738 await expect ( fooEnLocator ) . toHaveCount ( 1 )
3839 await expect ( fooEnLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foo-en' )
40+ await expect ( fooZhLocator ) . toHaveCount ( 0 )
41+ await expect ( fooChsLocator ) . toHaveCount ( 0 )
3942
4043 // navigate to zh-CN
4144 await page . locator ( '.e2e-theme-nav a' , { hasText : 'zh-CN' } ) . click ( )
@@ -61,6 +64,37 @@ test('should update head correctly', async ({ page }) => {
6164 await expect ( barLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foobar zh' )
6265 await expect ( bazLocator ) . toHaveCount ( 1 )
6366 await expect ( bazLocator . first ( ) ) . toHaveAttribute ( 'content' , 'baz' )
67+ await expect ( fooEnLocator ) . toHaveCount ( 0 )
6468 await expect ( fooZhLocator ) . toHaveCount ( 1 )
6569 await expect ( fooZhLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foo-zh' )
70+ await expect ( fooChsLocator ) . toHaveCount ( 0 )
71+
72+ // navigate to non-ASCII path
73+ await page . locator ( '.e2e-theme-nav a' , { hasText : '中文' } ) . click ( )
74+
75+ // lang
76+ await expect ( htmlLocator ) . toHaveAttribute ( 'lang' , '中文' )
77+ // title
78+ await expect ( page ) . toHaveTitle ( 'VuePress E2E' )
79+ await expect ( titleLocator ) . toHaveCount ( 1 )
80+ await expect ( titleLocator . first ( ) ) . toHaveText ( 'VuePress E2E' , {
81+ useInnerText : true ,
82+ } )
83+ // description
84+ await expect ( descriptionLocator ) . toHaveCount ( 1 )
85+ await expect ( descriptionLocator . first ( ) ) . toHaveAttribute (
86+ 'content' ,
87+ 'VuePress E2E 测试站点' ,
88+ )
89+ // head
90+ await expect ( fooLocator ) . toHaveCount ( 1 )
91+ await expect ( fooLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foo' )
92+ await expect ( barLocator ) . toHaveCount ( 1 )
93+ await expect ( barLocator . first ( ) ) . toHaveAttribute ( 'content' , '中文' )
94+ await expect ( bazLocator ) . toHaveCount ( 1 )
95+ await expect ( bazLocator . first ( ) ) . toHaveAttribute ( 'content' , 'baz' )
96+ await expect ( fooEnLocator ) . toHaveCount ( 0 )
97+ await expect ( fooZhLocator ) . toHaveCount ( 0 )
98+ await expect ( fooChsLocator ) . toHaveCount ( 1 )
99+ await expect ( fooChsLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foo-中文' )
66100} )
0 commit comments