refactor(web): extract ResourcesClient types + inline components, fix test TS errors
Extract types.ts, FilterDropdown.tsx, BooleanBadge.tsx from ResourcesClient.tsx into resource-client/ subdirectory. ResourcesClient reduced from 1,613 to 1,507 lines. Fix TypeScript strict mode errors across 8 test files: - Add id/order to BlueprintFieldDefinition test objects - Use FieldType enum instead of string literals in useFilters - Add non-null assertions for mock.calls array access - Type ScrollDiv for jsdom scrollLeft workaround - Fix exactOptionalPropertyTypes violations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,15 +15,18 @@ function fireKeydown(options: KeyboardEventInit) {
|
||||
// Helper: create a scroll container element with controllable scrollLeft
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function makeScrollContainer(): HTMLDivElement {
|
||||
const el = document.createElement("div");
|
||||
type ScrollDiv = HTMLDivElement & { _scrollLeft: number };
|
||||
|
||||
function makeScrollContainer(): ScrollDiv {
|
||||
const el = document.createElement("div") as ScrollDiv;
|
||||
el._scrollLeft = 0;
|
||||
// jsdom does not actually scroll, but we can track assignments
|
||||
Object.defineProperty(el, "scrollLeft", {
|
||||
get() {
|
||||
return this._scrollLeft ?? 0;
|
||||
return (this as ScrollDiv)._scrollLeft;
|
||||
},
|
||||
set(v: number) {
|
||||
this._scrollLeft = v;
|
||||
(this as ScrollDiv)._scrollLeft = v;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
@@ -53,7 +56,7 @@ function setWindowsPlatform() {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
describe("useTimelineKeyboard", () => {
|
||||
let scrollEl: HTMLDivElement;
|
||||
let scrollEl: ScrollDiv;
|
||||
let onDeleteSelected: ReturnType<typeof vi.fn>;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user