reporting-labs 0.6.15 → 0.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1648,7 +1648,8 @@ function visible(){
1648
1648
  return true;
1649
1649
  });
1650
1650
  }
1651
- function refresh(){
1651
+ // keepSelection: only select() passes it, so a test picked on purpose (Failures, API) stays shown
1652
+ function refresh(keepSelection){
1652
1653
  document.querySelectorAll('.pill').forEach(p=>p.setAttribute('aria-pressed',p.dataset.k===state.status));
1653
1654
  document.querySelectorAll('.dim .row').forEach(r=>{ const card=r.closest('.card'); const d=card.querySelector('h2').textContent.replace(/^By /,''); r.setAttribute('aria-pressed', state.dims[d]===r.querySelector('.k').textContent); });
1654
1655
  document.querySelectorAll('select[data-dim]').forEach(sel=>{ sel.value=state.dims[sel.dataset.dim]||''; });
@@ -1656,6 +1657,8 @@ function refresh(){
1656
1657
  const ss=$('#statussel'); if(ss) ss.value=state.status;
1657
1658
  const vis=visible(), ids=new Set(vis.map(t=>t.id));
1658
1659
  document.querySelectorAll('.cell').forEach(c=>c.classList.toggle('dim',!ids.has(c.dataset.id)));
1660
+ // a filter hid the selected test: show one that is in the list (select() re-renders it)
1661
+ if(vis.length&&!keepSelection&&!ids.has(state.selected)) return select(firstInteresting(vis), state.view!=='tests');
1659
1662
  const box=$('#items'); box.innerHTML='';
1660
1663
  if(!vis.length){ box.append(h('div',{class:'empty'},'No tests match. Clear the search or pick another filter.')); return; }
1661
1664
  document.querySelectorAll('.seg button').forEach(b=>b.setAttribute('aria-pressed',b.dataset.g===state.group));
@@ -1698,12 +1701,12 @@ function refresh(){
1698
1701
  for(const el of render(root,'',0)) box.append(el);
1699
1702
  }
1700
1703
  }
1701
- function firstInteresting(){ const f=data.tests.find(t=>isFail(t.outcome))||data.tests.find(t=>t.outcome==='flaky')||data.tests[0]; return f&&f.id; }
1704
+ function firstInteresting(ts=data.tests){ const f=ts.find(t=>isFail(t.outcome))||ts.find(t=>t.outcome==='flaky')||ts[0]; return f&&f.id; }
1702
1705
 
1703
1706
  /* ---------- detail ---------- */
1704
1707
  function select(id, quiet){
1705
1708
  const t=data.tests.find(x=>x.id===id); if(!t) return;
1706
- state.selected=id; state.retry=t.results.length-1; if(!quiet){ if(state.view!=='tests') showView('tests'); else setHash(); } refresh(); renderDetail(t);
1709
+ state.selected=id; state.retry=t.results.length-1; if(!quiet){ if(state.view!=='tests') showView('tests'); else setHash(); } refresh(true); renderDetail(t);
1707
1710
  const it=document.querySelector('.item[data-id="'+id+'"]'); if(it&&it.scrollIntoView) it.scrollIntoView({block:'nearest'});
1708
1711
  }
1709
1712
  function renderDetail(t, d, retryIdx){
package/dist/template.js CHANGED
@@ -1714,7 +1714,8 @@ function visible(){
1714
1714
  return true;
1715
1715
  });
1716
1716
  }
1717
- function refresh(){
1717
+ // keepSelection: only select() passes it, so a test picked on purpose (Failures, API) stays shown
1718
+ function refresh(keepSelection){
1718
1719
  document.querySelectorAll('.pill').forEach(p=>p.setAttribute('aria-pressed',p.dataset.k===state.status));
1719
1720
  document.querySelectorAll('.dim .row').forEach(r=>{ const card=r.closest('.card'); const d=card.querySelector('h2').textContent.replace(/^By /,''); r.setAttribute('aria-pressed', state.dims[d]===r.querySelector('.k').textContent); });
1720
1721
  document.querySelectorAll('select[data-dim]').forEach(sel=>{ sel.value=state.dims[sel.dataset.dim]||''; });
@@ -1722,6 +1723,8 @@ function refresh(){
1722
1723
  const ss=$('#statussel'); if(ss) ss.value=state.status;
1723
1724
  const vis=visible(), ids=new Set(vis.map(t=>t.id));
1724
1725
  document.querySelectorAll('.cell').forEach(c=>c.classList.toggle('dim',!ids.has(c.dataset.id)));
1726
+ // a filter hid the selected test: show one that is in the list (select() re-renders it)
1727
+ if(vis.length&&!keepSelection&&!ids.has(state.selected)) return select(firstInteresting(vis), state.view!=='tests');
1725
1728
  const box=$('#items'); box.innerHTML='';
1726
1729
  if(!vis.length){ box.append(h('div',{class:'empty'},'No tests match. Clear the search or pick another filter.')); return; }
1727
1730
  document.querySelectorAll('.seg button').forEach(b=>b.setAttribute('aria-pressed',b.dataset.g===state.group));
@@ -1764,12 +1767,12 @@ function refresh(){
1764
1767
  for(const el of render(root,'',0)) box.append(el);
1765
1768
  }
1766
1769
  }
1767
- function firstInteresting(){ const f=data.tests.find(t=>isFail(t.outcome))||data.tests.find(t=>t.outcome==='flaky')||data.tests[0]; return f&&f.id; }
1770
+ function firstInteresting(ts=data.tests){ const f=ts.find(t=>isFail(t.outcome))||ts.find(t=>t.outcome==='flaky')||ts[0]; return f&&f.id; }
1768
1771
 
1769
1772
  /* ---------- detail ---------- */
1770
1773
  function select(id, quiet){
1771
1774
  const t=data.tests.find(x=>x.id===id); if(!t) return;
1772
- state.selected=id; state.retry=t.results.length-1; if(!quiet){ if(state.view!=='tests') showView('tests'); else setHash(); } refresh(); renderDetail(t);
1775
+ state.selected=id; state.retry=t.results.length-1; if(!quiet){ if(state.view!=='tests') showView('tests'); else setHash(); } refresh(true); renderDetail(t);
1773
1776
  const it=document.querySelector('.item[data-id="'+id+'"]'); if(it&&it.scrollIntoView) it.scrollIntoView({block:'nearest'});
1774
1777
  }
1775
1778
  function renderDetail(t, d, retryIdx){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
5
5
  "keywords": [
6
6
  "test-report",