Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app): r1-b1 update native geometry fixture for elastic tabs

Diego Zacariase52fa29b4535
diff --git a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
index efcfe7891..901ced6dc 100644
--- a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
+++ b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
@@ -17,12 +17,16 @@ async function geometry(window) {
const workspace = document.querySelector('.chat-view-workspace').getBoundingClientRect()
const tabs = document.querySelector('.chat-view-tabs').getBoundingClientRect()
const active = document.querySelector('.chat-view-tab.is-active').getBoundingClientRect()
+ const inactive = document.querySelector('.chat-view-tab:not(.is-active)').getBoundingClientRect()
const scroller = document.querySelector('.chat-view-tabs__scroller')
const surface = document.querySelector('.chat-view-surface').getBoundingClientRect()
const surfaceStyle = getComputedStyle(document.querySelector('.chat-view-surface'))
const activeTab = document.querySelector('.chat-view-tab.is-active')
const activeStyle = getComputedStyle(activeTab)
- const listSeamStyle = getComputedStyle(document.querySelector('.chat-view-tabs__list'), '::after')
+ // The bottom shelf now lives on the non-scrolling .chat-view-tabs container
+ // (::after) so it stays under the whole visible strip when the tabs
+ // overflow and scroll — it used to live on the scrolling list.
+ const seamStyle = getComputedStyle(document.querySelector('.chat-view-tabs'), '::after')
const inactiveStyle = getComputedStyle(document.querySelector('.chat-view-tab:not(.is-active)'))
const inactiveBorderReferenceStyle = getComputedStyle(
document.querySelector('[data-inactive-tab-border-reference]')
@@ -35,6 +39,7 @@ async function geometry(window) {
)
return {
activeBottom: active.bottom,
+ activeWidth: active.width,
activeBackground: activeStyle.backgroundColor,
activeBackgroundImage: activeStyle.backgroundImage,
activeBorderBottom: activeStyle.borderBottomColor,
@@ -42,19 +47,26 @@ async function geometry(window) {
activeBorderBottomWidth: activeStyle.borderBottomWidth,
activeBorderTop: activeStyle.borderTopColor,
activeBorderTopStyle: activeStyle.borderTopStyle,
+ activeFlexShrink: activeStyle.flexShrink,
activeCloseBackground: activeCloseStyle.backgroundColor,
activeSelectBackground: activeSelectStyle.backgroundColor,
inactiveBackground: inactiveStyle.backgroundColor,
+ inactiveWidth: inactive.width,
+ inactiveBorderBottom: inactiveStyle.borderBottomColor,
inactiveBorderBottomStyle: inactiveStyle.borderBottomStyle,
inactiveBorderBottomWidth: inactiveStyle.borderBottomWidth,
inactiveBorderTop: inactiveStyle.borderTopColor,
inactiveBorderReferenceTop: inactiveBorderReferenceStyle.borderTopColor,
+ inactiveFlexShrink: inactiveStyle.flexShrink,
+ inactiveMinWidth: inactiveStyle.minWidth,
+ inactiveMaxWidth: inactiveStyle.maxWidth,
listClientWidth: scroller.clientWidth,
listOverflowX: getComputedStyle(scroller).overflowX,
- listSeamBackground: listSeamStyle.backgroundColor,
- listSeamBottom: listSeamStyle.bottom,
- listSeamHeight: listSeamStyle.height,
- listSeamPosition: listSeamStyle.position,
+ seamBackground: seamStyle.backgroundColor,
+ seamBottom: seamStyle.bottom,
+ seamHeight: seamStyle.height,
+ seamPosition: seamStyle.position,
+ seamZIndex: seamStyle.zIndex,
listScrollWidth: scroller.scrollWidth,
panelPaddingLeft: panelStyle.paddingLeft,
surfaceBackground: surfaceStyle.backgroundColor,
@@ -140,13 +152,18 @@ function assertTabTreatment(state, theme) {
)
assert.equal(
state.inactiveBorderBottomStyle,
- 'none',
- `${theme} inactive tabs have no bottom border`
+ 'solid',
+ `${theme} inactive tabs draw a bottom border to complete the shared seam`
)
assert.equal(
state.inactiveBorderBottomWidth,
- '0px',
- `${theme} inactive tabs have no bottom-border width`
+ '1px',
+ `${theme} inactive tabs draw a one-pixel bottom border`
+ )
+ assert.equal(
+ state.inactiveBorderBottom,
+ state.surfaceBorderTop,
+ `${theme} inactive bottom border uses the selected surface border treatment`
)
assert.equal(
state.inactiveBorderTop,
@@ -229,14 +246,40 @@ app.whenReady().then(async () => {
colorDistance(darkPaint.outsideBorder, darkPaint.outsideFill) >= 5,
'surface border remains visibly painted outside the selected tab'
)
- assert.equal(wide.listSeamPosition, 'absolute', 'tab list owns the shared surface seam')
- assert.equal(wide.listSeamBottom, '0px', 'shared seam occupies the tab row lower edge')
- assert.equal(wide.listSeamHeight, '1px', 'shared seam paints exactly one border row')
assert.equal(
- wide.listSeamBackground,
+ wide.seamPosition,
+ 'absolute',
+ 'the non-scrolling tab strip owns the shared surface seam'
+ )
+ assert.equal(wide.seamBottom, '0px', 'shared seam occupies the tab strip lower edge')
+ assert.equal(wide.seamHeight, '1px', 'shared seam paints exactly one border row')
+ assert.equal(
+ wide.seamZIndex,
+ '-1',
+ 'shared seam sits behind the opaque tabs so it only shows through their gaps'
+ )
+ assert.equal(
+ wide.seamBackground,
wide.surfaceBorderTop,
'shared seam uses the selected surface border treatment'
)
+ // Elastic tab sizing: tokens anchor a 220px ceiling and a 96px floor, and
+ // with only four tabs in a wide window each tab measures at the ceiling.
+ assert.equal(wide.inactiveMaxWidth, '220px', 'tabs cap at the --chat-tab-max ceiling')
+ assert.equal(wide.inactiveMinWidth, '96px', 'tabs never shrink below the --chat-tab-min floor')
+ assert.ok(
+ Math.abs(wide.inactiveWidth - 220) <= 1,
+ 'a wide window with few tabs holds each tab at the 220px ceiling'
+ )
+ assert.ok(
+ Math.abs(wide.activeWidth - 220) <= 1,
+ 'the active tab also sits at the 220px ceiling when there is room'
+ )
+ assert.equal(wide.inactiveFlexShrink, '1', 'inactive tabs shrink at the default rate')
+ assert.ok(
+ Number(wide.activeFlexShrink) < Number(wide.inactiveFlexShrink),
+ 'the active tab is configured to shrink slower than inactive tabs'
+ )
await window.webContents.executeJavaScript(
"document.documentElement.setAttribute('data-theme', 'light')"
)
@@ -249,7 +292,7 @@ app.whenReady().then(async () => {
'light active tab shares the surface border'
)
assert.equal(
- light.listSeamBackground,
+ light.seamBackground,
light.surfaceBorderTop,
'light shared seam uses the selected surface border treatment'
)
@@ -293,12 +336,45 @@ app.whenReady().then(async () => {
'the label remains transparent over the complete tab hover fill'
)
+ // Intermediate width: tabs have shrunk below the ceiling but the strip has
+ // not overflowed yet — proving the tabs give up width before the scroller
+ // ever scrolls.
+ window.setSize(700, 700)
+ await new Promise(resolve => setTimeout(resolve, 50))
+ const mid = await geometry(window)
+ assert.ok(
+ mid.listScrollWidth <= mid.listClientWidth + 1,
+ 'at an intermediate width the tab strip shrinks instead of overflowing'
+ )
+ assert.ok(
+ mid.inactiveWidth > 96 && mid.inactiveWidth < 220,
+ 'at an intermediate width inactive tabs sit between the 96px floor and 220px ceiling'
+ )
+ assert.ok(
+ mid.activeWidth > 96 && mid.activeWidth < 220,
+ 'at an intermediate width the active tab is also between floor and ceiling'
+ )
+ assert.ok(
+ mid.activeWidth > mid.inactiveWidth,
+ 'while shrinking, the active tab stays wider than an inactive one'
+ )
+
window.setSize(420, 700)
await new Promise(resolve => setTimeout(resolve, 50))
const narrow = await geometry(window)
const narrowPaint = await paintedSeam(window)
assert.equal(narrow.listOverflowX, 'auto', 'only the tab list owns horizontal overflow')
assert.ok(narrow.listScrollWidth > narrow.listClientWidth, 'long narrow tabs remain scrollable')
+ // Overflow only begins once even the slowest-shrinking (active) tab has
+ // bottomed out at the 96px floor — the scroller does not appear before then.
+ assert.ok(
+ Math.abs(narrow.inactiveWidth - 96) <= 1,
+ 'once the strip overflows, inactive tabs rest at the 96px floor'
+ )
+ assert.ok(
+ Math.abs(narrow.activeWidth - 96) <= 1,
+ 'once the strip overflows, the active tab has also reached the 96px floor'
+ )
assert.ok(
Math.abs(narrow.surfaceWidth - narrow.workspaceWidth) <= 1,
'narrow surface stays full width'
@@ -319,6 +395,47 @@ app.whenReady().then(async () => {
assert.equal(narrow.surfaceBorderLeftStyle, 'solid', 'narrow surface keeps its left border')
assert.equal(narrow.surfaceBorderRightStyle, 'solid', 'narrow surface keeps its right border')
+ // With the strip actually scrolled, the shelf must stay put and the active
+ // tab's notch must still mask the surface border beneath it. This is the
+ // reason the shelf was moved onto the non-scrolling container: a shelf on
+ // the scrolling list would slide out from under the visible tabs here.
+ window.setSize(360, 700)
+ await new Promise(resolve => setTimeout(resolve, 50))
+ const appliedScroll = await window.webContents.executeJavaScript(`(() => {
+ const scroller = document.querySelector('.chat-view-tabs__scroller')
+ scroller.scrollLeft = Math.floor((scroller.scrollWidth - scroller.clientWidth) / 2)
+ return scroller.scrollLeft
+ })()`)
+ await new Promise(resolve => setTimeout(resolve, 50))
+ assert.ok(appliedScroll > 0, 'the overflowing strip actually scrolls horizontally')
+ const scrolled = await geometry(window)
+ const scrolledPaint = await paintedSeam(window)
+ assert.equal(
+ scrolled.seamPosition,
+ 'absolute',
+ 'the shelf stays anchored to the non-scrolling container after scrolling'
+ )
+ assert.equal(scrolled.seamBottom, '0px', 'the scrolled shelf still hugs the strip lower edge')
+ assert.equal(scrolled.seamHeight, '1px', 'the scrolled shelf still paints exactly one row')
+ assert.equal(
+ scrolled.seamBackground,
+ scrolled.surfaceBorderTop,
+ 'the scrolled shelf keeps the selected surface border treatment'
+ )
+ assert.ok(
+ Math.abs(scrolled.surfaceTop - scrolled.activeBottom) <= 1,
+ 'the scrolled active tab and surface still share one border row'
+ )
+ assert.ok(
+ colorDistance(scrolledPaint.selectedSeam, scrolledPaint.selectedFill) <
+ colorDistance(scrolledPaint.outsideBorder, scrolledPaint.outsideFill) / 2,
+ 'the scrolled active tab still masks the surface border beneath its own span'
+ )
+ assert.ok(
+ colorDistance(scrolledPaint.outsideBorder, scrolledPaint.outsideFill) >= 5,
+ 'the shelf remains visibly painted outside the scrolled active tab'
+ )
+
console.log('chat workspace native geometry fixture: PASS')
app.exit(0)
} catch (error) {