Skip to content

Commit 3f32259

Browse files
committed
Align the title-bar surface audit with the zoom rework
'Scale desktop title bar with page zoom' (833d2f1) changed the CSS contract in two ways its audit test still pinned the old shape of: the lane vars gained a max() floor around the platform env() terms so page zoom cannot shrink the lane below the OS-drawn lights, and the control square became fixed px — CSS px already scale under zoom — leaving only the centering offset derived from the lane height. The test required the bare env() prefix and calc() on all three control vars, so it failed the commit that implemented its own regression comment. Pins now assert the env() term inside the clamp (still platform-derived, the test's actual intent) and split the control vars: offset must stay computed, size and icon are explicit constants.
1 parent 34208f6 commit 3f32259

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎apps/sim/app/_shell/desktop-title-bar-surfaces.test.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,28 @@ describe('desktop title-bar surface audit', () => {
8686
// Regression: a px clearance shrinks under page zoom while the OS-drawn lights
8787
// do not, so they end up drawn over the sidebar toggle.
8888
it('reserves the traffic-light lane from the platform, not hardcoded pixels', () => {
89-
expect(globalStyles).toContain('--desktop-title-bar-height: env(titlebar-area-height,')
90-
expect(globalStyles).toContain('--desktop-title-bar-inset-x: env(titlebar-area-x,')
89+
// The env() term is the platform-derived part; the max() floor keeps the
90+
// lane from collapsing below the OS-drawn lights under page zoom.
91+
expect(globalStyles).toContain('--desktop-title-bar-height: max(env(titlebar-area-height,')
92+
expect(globalStyles).toContain('--desktop-title-bar-inset-x: max(env(titlebar-area-x,')
9193

9294
// Scoped to the desktop block: the `:root` zeros are the deliberate
9395
// no-lane case, so only the overrides must stay derived.
9496
const insetBlock = globalStyles.match(
9597
/html\[data-sim-desktop-title-bar="inset"\]\s*\{([^}]*)\}/
9698
)?.[1]
9799
expect(insetBlock).toBeTypeOf('string')
100+
// The zoom rework split the lane from the control: the lane stays
101+
// platform-derived (clamped env() above), while the control is a fixed
102+
// square — CSS px already scale under page zoom, so only the centering
103+
// offset must remain computed from the lane height.
104+
expect(insetBlock).toMatch(/--desktop-title-bar-control-offset: calc\(/)
105+
expect(insetBlock).not.toMatch(/--desktop-title-bar-control-offset:\s*[\d.]+px/)
98106
for (const name of [
99107
'--desktop-title-bar-control-size',
100108
'--desktop-title-bar-control-icon-size',
101-
'--desktop-title-bar-control-offset',
102109
]) {
103-
expect(insetBlock).toMatch(new RegExp(`${name}: calc\\(`))
104-
expect(insetBlock).not.toMatch(new RegExp(`${name}:\\s*[\\d.]+px`))
110+
expect(insetBlock).toMatch(new RegExp(`${name}:\\s*[\\d.]+px`))
105111
}
106112

107113
// Both lane consumers read those vars; a literal in either is the bug.

0 commit comments

Comments
 (0)