@@ -5,7 +5,82 @@ test.beforeEach(async ({ page }) => {
55 await page . goto ( 'router/navigate-by-link.html' )
66} )
77
8- test ( 'TODO' , async ( { page } ) => {
9- // TODO
10- await expect ( page ) . toHaveURL ( `${ BASE } router/navigate-by-link.html` )
8+ test . describe ( 'should preserve query' , ( ) => {
9+ test ( 'markdown links with html suffix' , async ( { page } ) => {
10+ await page . locator ( '#markdown-links-with-html + ul > li > a' ) . nth ( 0 ) . click ( )
11+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true` )
12+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
13+ } )
14+
15+ test ( 'markdown links with md suffix' , async ( { page } ) => {
16+ await page . locator ( '#markdown-links-with-md + ul > li > a' ) . nth ( 0 ) . click ( )
17+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true` )
18+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
19+ } )
20+
21+ test ( 'html links' , async ( { page } ) => {
22+ await page . locator ( '#html-links + p > a' ) . nth ( 0 ) . click ( )
23+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true` )
24+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
25+ } )
26+ } )
27+
28+ test . describe ( 'should preserve query and hash' , ( ) => {
29+ test ( 'markdown links with html suffix' , async ( { page } ) => {
30+ await page . locator ( '#markdown-links-with-html + ul > li > a' ) . nth ( 1 ) . click ( )
31+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true#home` )
32+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
33+ } )
34+
35+ test ( 'markdown links with md suffix' , async ( { page } ) => {
36+ await page . locator ( '#markdown-links-with-md + ul > li > a' ) . nth ( 1 ) . click ( )
37+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true#home` )
38+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
39+ } )
40+
41+ test ( 'html links' , async ( { page } ) => {
42+ await page . locator ( '#html-links + p > a' ) . nth ( 1 ) . click ( )
43+ await expect ( page ) . toHaveURL ( `${ BASE } ?home=true#home` )
44+ await expect ( page . locator ( '#home-h2' ) ) . toHaveText ( 'Home H2' )
45+ } )
46+ } )
47+
48+ test . describe ( 'should preserve hash' , ( ) => {
49+ test ( 'markdown links with html suffix' , async ( { page } ) => {
50+ await page . locator ( '#markdown-links-with-html + ul > li > a' ) . nth ( 2 ) . click ( )
51+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404` )
52+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
53+ } )
54+
55+ test ( 'markdown links with md suffix' , async ( { page } ) => {
56+ await page . locator ( '#markdown-links-with-md + ul > li > a' ) . nth ( 2 ) . click ( )
57+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404` )
58+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
59+ } )
60+
61+ test ( 'html links' , async ( { page } ) => {
62+ await page . locator ( '#html-links + p > a' ) . nth ( 2 ) . click ( )
63+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404` )
64+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
65+ } )
66+ } )
67+
68+ test . describe ( 'should preserve hash and query' , ( ) => {
69+ test ( 'markdown links with html suffix' , async ( { page } ) => {
70+ await page . locator ( '#markdown-links-with-html + ul > li > a' ) . nth ( 3 ) . click ( )
71+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404?notFound=true` )
72+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
73+ } )
74+
75+ test ( 'markdown links with md suffix' , async ( { page } ) => {
76+ await page . locator ( '#markdown-links-with-md + ul > li > a' ) . nth ( 3 ) . click ( )
77+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404?notFound=true` )
78+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
79+ } )
80+
81+ test ( 'html links' , async ( { page } ) => {
82+ await page . locator ( '#html-links + p > a' ) . nth ( 3 ) . click ( )
83+ await expect ( page ) . toHaveURL ( `${ BASE } 404.html#404?notFound=true` )
84+ await expect ( page . locator ( '#notfound-h2' ) ) . toHaveText ( 'NotFound H2' )
85+ } )
1186} )
0 commit comments