@@ -36,3 +36,32 @@ test('should render config correctly', async ({ page }) => {
36
36
await expect ( locator . nth ( 1 ) ) . toHaveAttribute ( 'target' , '_blank' )
37
37
await expect ( locator . nth ( 1 ) ) . toHaveAttribute ( 'rel' , 'noopener noreferrer' )
38
38
} )
39
+
40
+ test ( 'should append attrs correctly' , async ( { page } ) => {
41
+ const locator = page . locator ( '.e2e-theme-content #attrs a' )
42
+
43
+ await expect ( locator . nth ( 0 ) ) . toHaveText ( 'text1' )
44
+ await expect ( locator . nth ( 0 ) ) . toHaveAttribute ( 'href' , BASE )
45
+ await expect ( locator . nth ( 0 ) ) . toHaveAttribute ( 'aria-label' , 'label' )
46
+ await expect ( locator . nth ( 0 ) ) . toHaveAttribute ( 'class' , / c l a s s / )
47
+ await expect ( locator . nth ( 0 ) ) . not . toHaveAttribute ( 'icon' )
48
+
49
+ await expect ( locator . nth ( 1 ) ) . toHaveText ( 'text2' )
50
+ await expect ( locator . nth ( 1 ) ) . toHaveAttribute (
51
+ 'href' ,
52
+ 'https://example.com/test/' ,
53
+ )
54
+ await expect ( locator . nth ( 1 ) ) . toHaveAttribute ( 'target' , '_blank' )
55
+ await expect ( locator . nth ( 1 ) ) . toHaveAttribute ( 'rel' , 'noopener noreferrer' )
56
+ await expect ( locator . nth ( 1 ) ) . toHaveAttribute ( 'id' , 'id' )
57
+ await expect ( locator . nth ( 1 ) ) . not . toHaveAttribute ( 'unknown' )
58
+
59
+ await expect ( locator . nth ( 2 ) ) . toHaveText ( 'text3' )
60
+ await expect ( locator . nth ( 2 ) ) . toHaveAttribute (
61
+ 'href' ,
62
+ 'https://example.com/test.png' ,
63
+ )
64
+ await expect ( locator . nth ( 2 ) ) . toHaveAttribute ( 'target' , '_blank' )
65
+ await expect ( locator . nth ( 2 ) ) . toHaveAttribute ( 'rel' , 'noopener noreferrer' )
66
+ await expect ( locator . nth ( 2 ) ) . toHaveAttribute ( 'download' , 'example-test.png' )
67
+ } )
0 commit comments