← Commit history

render-view: bare showcase checks (#79)

Colby Knox ·90cb4ebbc5 · ·parent d7f9c26
1 file changed +18
test/render-view.mjs+18
@@ -107,6 +107,24 @@ try {   ok('the review-tour spotlight never appears in the render view (tour on, nothing ticked)', ring.lit.length === 0, JSON.stringify(ring));   ok('the render view draws no outline around the title', !/solid/.test(ring.outline), JSON.stringify(ring));   ok('the page scripts parse and boot (app.js defines $ and render)', booted);+  // #79: a bare showcase keeps the import's alpha. The slot used to keep a+  // solid #0d1117 fill, and hiding it showed the CSS mock app underneath.+  const clearPng = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';+  await fetch(base + '/state', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ aiThread: 'render-view test', mode: 'app', layout: 'bleed-bottom', showcase: { src: clearPng, full: false, chrome: 'bare' } }) });+  const bv = await browser.newPage();+  await bv.setViewport({ width: 1680, height: 1080, deviceScaleFactor: 1 });+  await bv.goto(base + '/?render=1', { waitUntil: 'networkidle2', timeout: 15000 }).catch(() => {});+  await new Promise(r => setTimeout(r, 1200));+  const bare = await bv.evaluate(() => {+    const hero = document.getElementById('hero');+    const img = hero && hero.querySelector('.showcase-img');+    const body = hero && hero.querySelector('.appbody');+    const shown = body ? [...body.children].filter(c => !c.classList.contains('showcase-img') && getComputedStyle(c).visibility !== 'hidden').map(c => c.className) : ['no appbody'];+    return { bare: !!hero && hero.classList.contains('bare-chrome'), imgBg: img ? getComputedStyle(img).backgroundColor : 'none', winBg: getComputedStyle(hero.querySelector('.window')).backgroundColor, shown };+  });+  ok('a bare showcase is posed as bare', bare.bare, JSON.stringify(bare));+  ok('  and its image slot paints no fill behind a transparent import', bare.imgBg === 'rgba(0, 0, 0, 0)', JSON.stringify(bare));+  ok('  and the mock app under it stays hidden', bare.shown.length === 0, JSON.stringify(bare));    // Through a code-server style path prefix (hero-studio#68: localhost:1431/__cs/proxy/8846/?render=1):   // every asset and data URL must resolve under the prefix, and the view must hold still while the