File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -836,12 +836,40 @@ function defineTest(f: Fixture) {
836836 await expectNoDuplicateServerCss ( page )
837837 } )
838838
839- // TODO: need a way to add/ remove links on server hmr. for now, it requires a manually reload.
840- test . skip ( 'adding/removing css server @js' , async ( { page } ) => {
839+ // TODO: need a way to remove css links on server hmr. for now, it requires a manually reload.
840+ test ( 'adding/removing css server @js' , async ( { page } ) => {
841841 await page . goto ( f . url ( ) )
842842 await waitForHydration ( page )
843+ await expect ( page . locator ( '.test-style-server' ) ) . toHaveCSS (
844+ 'color' ,
845+ 'rgb(255, 165, 0)' ,
846+ )
847+
848+ // remove css import
849+ const editor = f . createEditor ( 'src/routes/style-server/server.tsx' )
850+ editor . edit ( ( s ) =>
851+ s . replaceAll ( `import './server.css'` , `/* import './server.css' */` ) ,
852+ )
853+ await page . waitForTimeout ( 100 )
854+ await expect ( async ( ) => {
855+ // TODO: shouldn't require reload
856+ await page . reload ( )
857+ await expect ( page . locator ( '.test-style-server' ) ) . toHaveCSS (
858+ 'color' ,
859+ 'rgb(0, 0, 0)' ,
860+ { timeout : 10 } ,
861+ )
862+ } ) . toPass ( )
863+
864+ // adding css works without reload
865+ await waitForHydration ( page )
843866 await using _ = await expectNoReload ( page )
844- await testAddRemoveCssServer ( page , { js : true } )
867+
868+ editor . reset ( )
869+ await expect ( page . locator ( '.test-style-server' ) ) . toHaveCSS (
870+ 'color' ,
871+ 'rgb(255, 165, 0)' ,
872+ )
845873 } )
846874
847875 testNoJs ( 'adding/removing css server @nojs' , async ( { page } ) => {
You can’t perform that action at this time.
0 commit comments