@@ -89,6 +89,14 @@ test('clears all active toasts', async ({ page }) => {
89
89
await expect ( page . locator ( '._toastItem' ) ) . toHaveCount ( 0 )
90
90
} )
91
91
92
+ test ( '`push()` accepts both string and obj' , async ( { page } ) => {
93
+ await page . goto ( '/' , { waitUntil : 'networkidle' } )
94
+ await page . evaluate ( `window.toast.push('push with string')` )
95
+ await expect ( page . getByText ( 'push with string' ) ) . toBeVisible ( )
96
+ await page . evaluate ( `window.toast.push({msg:'push with obj'})` )
97
+ await expect ( page . getByText ( 'push with obj' ) ) . toBeVisible ( )
98
+ } )
99
+
92
100
test ( 'pushes to correct container target' , async ( { page } ) => {
93
101
await page . goto ( '/' )
94
102
await page . getByTestId ( 'createNewToastContainer' ) . click ( )
@@ -252,14 +260,6 @@ test('`progress` key still works', async ({ page }) => {
252
260
expect ( await get ( ) ) . toBe ( 0.2 )
253
261
} )
254
262
255
- test ( '`push()` accepts both string and obj' , async ( { page } ) => {
256
- await page . goto ( '/' , { waitUntil : 'networkidle' } )
257
- await page . evaluate ( `window.toast.push('push with string')` )
258
- await expect ( page . getByText ( 'push with string' ) ) . toBeVisible ( )
259
- await page . evaluate ( `window.toast.push({msg:'push with obj'})` )
260
- await expect ( page . getByText ( 'push with obj' ) ) . toBeVisible ( )
261
- } )
262
-
263
263
test ( 'removes toasts from container via filter fn' , async ( { page } ) => {
264
264
await page . goto ( '/' , { waitUntil : 'networkidle' } )
265
265
for ( let a = 0 ; a < 3 ; a ++ ) {
@@ -268,3 +268,15 @@ test('removes toasts from container via filter fn', async ({ page }) => {
268
268
await page . evaluate ( `window.toast.pop(i=>i.target!=='new')` )
269
269
await expect ( page . locator ( '._toastItem' ) ) . toHaveCount ( 0 )
270
270
} )
271
+
272
+ test ( 'deprecated css vars still work' , async ( { page } ) => {
273
+ const snap = async ( sel ) => await page . locator ( sel ) . screenshot ( { animations : 'disabled' } )
274
+ await page . goto ( '/' , { waitUntil : 'networkidle' } )
275
+ await page . evaluate ( ( ) => {
276
+ window . toast . push ( '' , { next : 1 , theme : { '--toastBarBackground' : 'red' } } )
277
+ window . toast . push ( '' , { next : 1 , theme : { '--toastProgressBackground' : 'red' } } )
278
+ } )
279
+ const ss0 = await snap ( '._toastContainer li:first-child ._toastBar' )
280
+ const ss1 = await snap ( '._toastContainer li:last-child ._toastBar' )
281
+ expect ( ss0 ) . toEqual ( ss1 )
282
+ } )
0 commit comments