Skip to content

Commit da501fd

Browse files
committed
test(app-shell): pin the phone bar pages' growing route slot (#36792)
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9d14a81 commit da501fd

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

‎ui/packages/app-shell/src/layout/__tests__/ConsoleLayout.phoneRecordOneBar-28483.test.tsx‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,67 @@ describe('the phone bottom bar is drawn on its three pages only (objectstack#358
228228
});
229229
});
230230

231+
/**
232+
* objectstack#36792 — a scroll container's end padding scrolls only after its
233+
* in-flow content. While the bar is drawn the inset (the element that scrolls)
234+
* keeps the bar's height as end padding, so on the bar's home and approvals
235+
* pages, which grow with their content, the route slot grows with its page
236+
* (a one-track grid at least the inset's height): the slot is the inset's
237+
* in-flow content and the padding lands after the page's last row. A fixed
238+
* `h-full` slot there let a tall page overflow it, and the scroll ended at the
239+
* page's bottom, under the bar. The inbox list, an object list page that
240+
* bounds itself, keeps the fixed slot; so does every route without the bar.
241+
*/
242+
describe('a phone bar page\'s end inset scrolls with its content (objectstack#36792)', () => {
243+
const slot = () => screen.getByTestId('console-route');
244+
const slotGrows = () => {
245+
const c = slot().classList;
246+
return c.contains('grid') && c.contains('min-h-full') && c.contains('h-auto') && !c.contains('h-full');
247+
};
248+
const slotFixed = () => {
249+
const c = slot().classList;
250+
return c.contains('h-full') && !c.contains('min-h-full') && !c.contains('grid');
251+
};
252+
const scrollerPadsEnd = () => {
253+
const scroller = slot().parentElement!;
254+
return (
255+
scroller.classList.contains('overflow-y-auto') &&
256+
scroller.classList.contains('!pb-[calc(3.5rem+env(safe-area-inset-bottom))]')
257+
);
258+
};
259+
260+
it('at 375 px the app home and the approvals inbox grow the slot inside the padded scroller', () => {
261+
for (const path of ['/apps/crm', '/apps/crm/', '/apps/crm/system/approvals']) {
262+
mountAt(path, 375);
263+
expect(slotGrows(), path).toBe(true);
264+
expect(scrollerPadsEnd(), path).toBe(true);
265+
// The track never widens the slot past the inset.
266+
expect(slot().classList.contains('grid-cols-[minmax(0,1fr)]'), path).toBe(true);
267+
cleanup();
268+
}
269+
});
270+
271+
it('at 375 px the inbox list keeps the fixed slot: it bounds itself above the bar', () => {
272+
mountAt('/apps/crm/sys_inbox_message', 375);
273+
expect(slotFixed()).toBe(true);
274+
expect(scrollerPadsEnd()).toBe(true);
275+
});
276+
277+
it('CONTROL — routes without the bar, and every route from 768 px up, keep the fixed slot', () => {
278+
for (const [path, width] of [
279+
['/apps/crm/crm_lead', 375],
280+
[RECORD, 375],
281+
['/apps/crm/page/home', 375],
282+
['/apps/crm', 768],
283+
['/apps/crm/system/approvals', 1440],
284+
] as const) {
285+
mountAt(path, width);
286+
expect(slotFixed(), `${width} px ${path}`).toBe(true);
287+
cleanup();
288+
}
289+
});
290+
});
291+
231292
describe('an app\'s docs pages draw in the app shell from 768 px up (objectstack#37150), and no app menu (objectstack#35424)', () => {
232293
const sidebar = () => screen.queryByTestId('sidebar-stub');
233294
const DOCS_PATHS = [

0 commit comments

Comments
 (0)