@@ -9,6 +9,7 @@ test('should update head correctly', async ({ page }) => {
9
9
const bazLocator = page . locator ( 'head meta[name="baz"]' )
10
10
const fooEnLocator = page . locator ( 'head meta[name="foo-en"]' )
11
11
const fooZhLocator = page . locator ( 'head meta[name="foo-zh"]' )
12
+ const fooChsLocator = page . locator ( 'head meta[name="foo-中文"]' )
12
13
13
14
// en-US
14
15
await page . goto ( '' )
@@ -36,6 +37,8 @@ test('should update head correctly', async ({ page }) => {
36
37
await expect ( bazLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foobar baz' )
37
38
await expect ( fooEnLocator ) . toHaveCount ( 1 )
38
39
await expect ( fooEnLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foo-en' )
40
+ await expect ( fooZhLocator ) . toHaveCount ( 0 )
41
+ await expect ( fooChsLocator ) . toHaveCount ( 0 )
39
42
40
43
// navigate to zh-CN
41
44
await page . locator ( '.e2e-theme-nav a' , { hasText : 'zh-CN' } ) . click ( )
@@ -61,6 +64,37 @@ test('should update head correctly', async ({ page }) => {
61
64
await expect ( barLocator . first ( ) ) . toHaveAttribute ( 'content' , 'foobar zh' )
62
65
await expect ( bazLocator ) . toHaveCount ( 1 )
63
66
await expect ( bazLocator . first ( ) ) . toHaveAttribute ( 'content' , 'baz' )
67
+ await expect ( fooEnLocator ) . toHaveCount ( 0 )
64
68
await expect ( fooZhLocator ) . toHaveCount ( 1 )
65
69
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-中文' )
66
100
} )
0 commit comments