@@ -89,6 +89,14 @@ test('clears all active toasts', async ({ page }) => {
8989 await expect ( page . locator ( '._toastItem' ) ) . toHaveCount ( 0 )
9090} )
9191
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+
92100test ( 'pushes to correct container target' , async ( { page } ) => {
93101 await page . goto ( '/' )
94102 await page . getByTestId ( 'createNewToastContainer' ) . click ( )
@@ -252,14 +260,6 @@ test('`progress` key still works', async ({ page }) => {
252260 expect ( await get ( ) ) . toBe ( 0.2 )
253261} )
254262
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-
263263test ( 'removes toasts from container via filter fn' , async ( { page } ) => {
264264 await page . goto ( '/' , { waitUntil : 'networkidle' } )
265265 for ( let a = 0 ; a < 3 ; a ++ ) {
@@ -268,3 +268,15 @@ test('removes toasts from container via filter fn', async ({ page }) => {
268268 await page . evaluate ( `window.toast.pop(i=>i.target!=='new')` )
269269 await expect ( page . locator ( '._toastItem' ) ) . toHaveCount ( 0 )
270270} )
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