File tree Expand file tree Collapse file tree 3 files changed +21
-10
lines changed 
examples/basic/src/routes/assets Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -1183,13 +1183,24 @@ function defineTest(f: Fixture) {
11831183  test ( 'assets' ,  async  ( {  page } )  =>  { 
11841184    await  page . goto ( f . url ( ) ) 
11851185    await  waitForHydration ( page ) 
1186-     // await expect(page.getByAltText('Vite logo')).not.toHaveJSProperty( 
1187-     //   'naturalWidth', 
1188-     //   0, 
1189-     // ) 
1190-     // await expect(page.getByAltText('React logo')).not.toHaveJSProperty( 
1191-     //   'naturalWidth', 
1192-     //   0, 
1193-     // ) 
1186+     await  expect ( 
1187+       page . getByTestId ( 'test-assets-server-import' ) , 
1188+     ) . not . toHaveJSProperty ( 'naturalWidth' ,  0 ) 
1189+     await  expect ( 
1190+       page . getByTestId ( 'test-assets-client-import' ) , 
1191+     ) . not . toHaveJSProperty ( 'naturalWidth' ,  0 ) 
1192+ 
1193+     async  function  testBackgroundImage ( selector : string )  { 
1194+       const  url  =  await  page 
1195+         . locator ( selector ) 
1196+         . evaluate ( ( el )  =>  getComputedStyle ( el ) . backgroundImage ) 
1197+       expect ( url ) . toMatch ( / ^ u r l \( .* \) $ / ) 
1198+       const  response  =  await  page . request . get ( url . slice ( 5 ,  - 2 ) ) 
1199+       expect ( response . ok ( ) ) . toBeTruthy ( ) 
1200+       expect ( response . headers ( ) [ 'content-type' ] ) . toBe ( 'image/svg+xml' ) 
1201+     } 
1202+ 
1203+     await  testBackgroundImage ( '.test-assets-server-css' ) 
1204+     await  testBackgroundImage ( '.test-assets-client-css' ) 
11941205  } ) 
11951206} 
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export function TestAssetsClient() {
99      < span > test-assets-client</ span > 
1010      < img 
1111        src = { svg } 
12-         data-testid = "test-assets-client-js " 
12+         data-testid = "test-assets-client-import " 
1313        width = "20" 
1414        height = "20" 
1515      /> 
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export function TestAssetsServer() {
99        < span > test-assets-server</ span > 
1010        < img 
1111          src = { svg } 
12-           data-testid = "test-assets-server-js " 
12+           data-testid = "test-assets-server-import " 
1313          width = "20" 
1414          height = "20" 
1515        /> 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments