|
@@ -275,13 +275,15 @@ describe('LabelTemplatePickerModal', () => {
|
|
|
expect(screen.getByText(/No spools match/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/No spools match/i)).toBeInTheDocument();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('lets the spool list shrink (min-h-0) so all 4 templates and Cancel stay visible on short viewports (#1230)', () => {
|
|
|
|
|
- // Regression for #1230: on viewports where 90vh is tight (Windows 11
|
|
|
|
|
- // browser-chrome or DPI scaling), an explicit min-h on the spool list
|
|
|
|
|
- // pinned it taller than the modal could give back to templates + footer,
|
|
|
|
|
- // and `overflow-hidden` on the outer modal clipped the 4th template
|
|
|
|
|
- // (Avery 5160) and the Cancel button. The fix is `min-h-0` so the
|
|
|
|
|
- // flex-1 spool list can yield space when needed.
|
|
|
|
|
|
|
+ it('packs templates into a 2x2 grid so all 4 plus Cancel fit on short viewports (#1230)', () => {
|
|
|
|
|
+ // Regression for #1230: with 4 templates stacked vertically (~310px) plus
|
|
|
|
|
+ // header/search/action bar/footer, the modal blew past max-h-[90vh] on
|
|
|
|
|
+ // Windows-11 + Brave-style viewports where browser chrome eats into 90vh.
|
|
|
|
|
+ // overflow-hidden on the modal then clipped Avery 5160 and the Cancel
|
|
|
|
|
+ // footer with no scroll path. The fix uses sm:grid-cols-2 so the 4
|
|
|
|
|
+ // templates render as a 2x2 grid (~155px), trimming ~150px of vertical
|
|
|
|
|
+ // and leaving room for the footer. The earlier min-h-0 on the spool list
|
|
|
|
|
+ // is kept so it still yields any remaining slack.
|
|
|
const { container } = render(
|
|
const { container } = render(
|
|
|
<LabelTemplatePickerModal
|
|
<LabelTemplatePickerModal
|
|
|
isOpen={true}
|
|
isOpen={true}
|
|
@@ -299,9 +301,15 @@ describe('LabelTemplatePickerModal', () => {
|
|
|
expect(screen.getByText(/Avery 5160/i)).toBeInTheDocument();
|
|
expect(screen.getByText(/Avery 5160/i)).toBeInTheDocument();
|
|
|
expect(screen.getByRole('button', { name: /Cancel/i })).toBeInTheDocument();
|
|
expect(screen.getByRole('button', { name: /Cancel/i })).toBeInTheDocument();
|
|
|
|
|
|
|
|
- // Structural guard against the regression: the scrollable spool list
|
|
|
|
|
- // must have `min-h-0` so flex shrinking actually works, and must NOT
|
|
|
|
|
- // pin a fixed minimum height that prevents it.
|
|
|
|
|
|
|
+ // Templates section must be a responsive grid (single column on mobile,
|
|
|
|
|
+ // two columns from sm: up) — a future refactor that drops the grid and
|
|
|
|
|
+ // reintroduces stacked rows fails CI.
|
|
|
|
|
+ const templatesSection = container.querySelector('div.grid.sm\\:grid-cols-2');
|
|
|
|
|
+ expect(templatesSection).not.toBeNull();
|
|
|
|
|
+ expect(templatesSection!.className).toContain('grid-cols-1');
|
|
|
|
|
+ expect(templatesSection!.querySelectorAll('button').length).toBe(4);
|
|
|
|
|
+
|
|
|
|
|
+ // Spool list still uses min-h-0 so it can yield further on very tight viewports.
|
|
|
const spoolListScroller = container.querySelector('div.flex-1.overflow-y-auto');
|
|
const spoolListScroller = container.querySelector('div.flex-1.overflow-y-auto');
|
|
|
expect(spoolListScroller).not.toBeNull();
|
|
expect(spoolListScroller).not.toBeNull();
|
|
|
expect(spoolListScroller!.className).toContain('min-h-0');
|
|
expect(spoolListScroller!.className).toContain('min-h-0');
|