feat(FN-1596): increase width of quick-add task text entry box
- Add CSS rule to override padding-right for QuickEntryBox textarea - The .description-with-refine textarea rule was adding 70px padding that wasn't needed in QuickEntryBox (refine button is in controls panel) - Add regression tests for textarea width contract - Add mockDesktopViewport helper for viewport-specific tests - Keep max-width: 800px constraint in list view (design decision)
This commit is contained in:
@@ -197,6 +197,20 @@ function clickSave() {
|
||||
fireEvent.click(screen.getByTestId("quick-entry-save"));
|
||||
}
|
||||
|
||||
function mockDesktopViewport() {
|
||||
Object.defineProperty(window, "innerWidth", { value: 1280, configurable: true });
|
||||
return vi.spyOn(window, "matchMedia").mockImplementation((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
}));
|
||||
}
|
||||
|
||||
describe("QuickEntryBox", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -2629,4 +2643,31 @@ describe("QuickEntryBox", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("textarea width contract (FN-1596)", () => {
|
||||
it("textarea spans full width of the quick-entry-box container", () => {
|
||||
mockDesktopViewport();
|
||||
renderQuickEntryBox({});
|
||||
const quickEntryBox = screen.getByTestId("quick-entry-box");
|
||||
const input = screen.getByTestId("quick-entry-input") as HTMLTextAreaElement;
|
||||
|
||||
// Get the bounding rectangles for the textarea and its container
|
||||
const inputRect = input.getBoundingClientRect();
|
||||
const containerRect = quickEntryBox.getBoundingClientRect();
|
||||
|
||||
// The textarea should span the full width of its container (within 2px tolerance for rounding)
|
||||
// This ensures the input visually reaches the right edge of the container
|
||||
expect(inputRect.width).toBeGreaterThanOrEqual(containerRect.width - 2);
|
||||
|
||||
// The textarea should be at least 80% of the container width
|
||||
// (accounting for the toggle button on the right)
|
||||
expect(inputRect.width).toBeGreaterThanOrEqual(containerRect.width * 0.8);
|
||||
});
|
||||
|
||||
it("textarea wrapper has quick-entry-textarea-wrap class for CSS targeting", () => {
|
||||
renderQuickEntryBox({});
|
||||
const wrapper = screen.getByTestId("quick-entry-input").parentElement;
|
||||
expect(wrapper).toHaveClass("quick-entry-textarea-wrap");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14032,6 +14032,12 @@ html .column.drag-over * {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Override padding from .description-with-refine textarea to fill available width */
|
||||
/* The refine button is in the controls panel, not overlaid on textarea */
|
||||
.quick-entry-textarea-wrap textarea {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
/* Quick Entry Box expand button - bottom-right of textarea */
|
||||
.quick-entry-expand-btn {
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user