diff --git a/tests/browser_test.mjs b/tests/browser_test.mjs index 03bd02d..b5c458b 100644 --- a/tests/browser_test.mjs +++ b/tests/browser_test.mjs @@ -87,6 +87,8 @@ try{ await waitFor(()=>site.eval(`location.pathname==='/carrinho' && getComputedStyle($('carr')).display!=='none' && getComputedStyle($('foco')).display==='none'`),'cart page'); // Removing an item is one click and can be undone. await site.click('[data-rmi="0"]'); + // The empty state is painted on the next animation frame (site-steps.js). + await waitFor(()=>site.eval(`!$('carrVazio').hidden||document.documentElement.hasAttribute('data-sem-itens')`),'empty cart state'); assert.deepEqual(await site.eval(`({items:pedido.length,empty:!$('carrVazio').hidden||document.documentElement.hasAttribute('data-sem-itens'),undo:!$('desfazer').hidden})`),{items:0,empty:true,undo:true}); await site.click('#desfazerBtn'); assert.equal(await site.eval('pedido.length===1 && pedido[0].total===21.89 && $("desfazer").hidden'),true); diff --git a/web/site-packing.js b/web/site-packing.js index e9a3124..e4d4f35 100644 --- a/web/site-packing.js +++ b/web/site-packing.js @@ -302,6 +302,8 @@ function previaAoVivo(){ return; } tMont=setTimeout(()=>{ + // o produto pode ter sido fechado nesses 140 ms (item foi para o carrinho) + if(!modo) return; const prontas=artes.filter(a=>a.cm>0 && a.cm<=larguraFilme() && a.src); const W=Math.round(300*ZOOMS[zoomI]); $('vArea').classList.toggle('ampliado', zoomI>0); diff --git a/web/site-quality.js b/web/site-quality.js index 6c9c7d4..f7fcaac 100644 --- a/web/site-quality.js +++ b/web/site-quality.js @@ -88,6 +88,8 @@ let tAval=null; function agendaAvaliacao(){ clearTimeout(tAval); tAval=setTimeout(()=>{ + // o produto pode ter sido fechado nesses 220 ms (item foi para o carrinho) + if(!modo) return; const r=avaliar(); const el=$('aoVivo'); if(!el) return;