dynamic-forms-material / Class

MinimalTestBuilder

MINIMAL TEST DATA BUILDERS

Philosophy: Only create what you're testing

Benefits:

  • Clear intent (builder name matches test purpose)
  • Fast execution (no unnecessary fields/data)
  • Reusable (consistent patterns across tests)
  • Maintainable (change in one place)

Static Methods

static

minimal()

Absolute minimum: single field with default config Use when testing framework basics, not specific properties

Presentation
static minimal(fieldType: "input" | "select" | "checkbox" | "textarea" | "datepicker" | "slider" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; };
Parameters
NameTypeDescription
fieldType
"input" | "select" | "checkbox" | "textarea" | "datepicker" | "slider"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; }
static

withAppearance()

Single field with Material appearance Use when testing Material-specific styling

Presentation
static withAppearance(appearance: "fill" | "outline"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
appearance
"fill" | "outline"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withCheckbox()

Single checkbox Use when testing checkbox rendering

Presentation
static withCheckbox(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withCheckboxColor()

Multi-checkbox with color Use when testing Material color theme

Presentation
static withCheckboxColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
Parameters
NameTypeDescription
color
"primary" | "accent" | "warn"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; }
static

withCheckboxColorSingle()

Checkbox with color Use when testing Material color theme

Presentation
static withCheckboxColorSingle(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Parameters
NameTypeDescription
color
"primary" | "accent" | "warn"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withCheckboxLabelPosition()

Multi-checkbox with label position Use when testing checkbox label positioning

Presentation
static withCheckboxLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
Parameters
NameTypeDescription
labelPosition
"before" | "after"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; }
static

withCheckboxLabelPositionSingle()

Checkbox with label position Use when testing checkbox label positioning

Presentation
static withCheckboxLabelPositionSingle(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Parameters
NameTypeDescription
labelPosition
"before" | "after"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withCheckboxOptions()

Single multi-checkbox with options Use when testing checkbox group rendering

Presentation
static withCheckboxOptions(options: FieldOption<unknown>[]): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
Parameters
NameTypeDescription
options
FieldOption<unknown>[]
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; }
static

withClassName()

Single field with custom CSS class Use when testing custom styling

Presentation
static withClassName(className: string, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
className
string
fieldType
"input" | "textarea"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withCols()

Single textarea with cols attribute Use when testing textarea columns configuration

Presentation
static withCols(cols: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
cols
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withDisabled()

Single field with disabled state Use when testing disabled behavior

Presentation
static withDisabled(disabled: boolean = true): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
disabled
boolean
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withDisabledCheckboxOption()

Multi-checkbox with disabled option Use when testing disabled option state

Presentation
static withDisabledCheckboxOption(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; }
static

withDisabledOption()

Single select with disabled option Use when testing option disabled state

Presentation
static withDisabledOption(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; }
static

withHint()

Single field with hint text Use when testing hint/help text rendering

Presentation
static withHint(hint: string): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
hint
string
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withInputType()

Single input field with specific type attribute Use when testing input type rendering (email, password, number, etc.)

Presentation
static withInputType(type: "number" | "text" | "email" | "password" | "tel" | "url"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
type
"number" | "text" | "email" | "password" | "tel" | "url"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withLabel()

Single field with label Use when testing label rendering

Presentation
static withLabel(label: string, fieldType: "input" | "select" | "checkbox" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; };
Parameters
NameTypeDescription
label
string
fieldType
"input" | "select" | "checkbox"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean | null; }; }
static

withMaxLength()

Single textarea with maxLength attribute Use when testing maxlength validation

Presentation
static withMaxLength(maxLength: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
maxLength
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withMultipleFields()

Multiple fields of same type Use when testing multiple field rendering or interaction

Presentation
static withMultipleFields(count: number, fieldType: "input" | "select" | "checkbox" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: Record<string, string | number | boolean | null>; };
Parameters
NameTypeDescription
count
number
fieldType
"input" | "select" | "checkbox"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: Record<string, string | number | boolean | null>; }
static

withMultiSelect()

Single multi-select Use when testing multiple selection

Presentation
static withMultiSelect(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: never[]; }; }
static

withPlaceholder()

Single field with placeholder Use when testing placeholder attribute

Presentation
static withPlaceholder(placeholder: string, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
placeholder
string
fieldType
"input" | "textarea"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withRadioColor()

Radio group with color Use when testing Material color theme

Presentation
static withRadioColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
Parameters
NameTypeDescription
color
"primary" | "accent" | "warn"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; }
static

withRadioLabelPosition()

Radio group with label position Use when testing radio label positioning

Presentation
static withRadioLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
Parameters
NameTypeDescription
labelPosition
"before" | "after"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; }
static

withRadioOptions()

Single radio group with options Use when testing radio group rendering

Presentation
static withRadioOptions(options: FieldOption<unknown>[]): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
Parameters
NameTypeDescription
options
FieldOption<unknown>[]
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; }
static

withRequired()

Single field marked as required Use when testing required validation

Presentation
static withRequired(required: boolean = true, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
required
boolean
fieldType
"input" | "textarea"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withResize()

Single textarea with resize style Use when testing textarea resize behavior

Presentation
static withResize(resize: "none" | "both" | "horizontal" | "vertical"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
resize
"none" | "both" | "horizontal" | "vertical"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withRows()

Single textarea with rows attribute Use when testing textarea rows configuration

Presentation
static withRows(rows: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
rows
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withSelectOptions()

Single select with simple options Use when testing basic select rendering

Presentation
static withSelectOptions(options: FieldOption<unknown>[]): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; };
Parameters
NameTypeDescription
options
FieldOption<unknown>[]
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: null; }; }
static

withSliderColor()

Slider with color Use when testing Material color theme

Presentation
static withSliderColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
Parameters
NameTypeDescription
color
"primary" | "accent" | "warn"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; }
static

withSliderRange()

Single slider with min/max Use when testing slider range

Presentation
static withSliderRange(min: number, max: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
Parameters
NameTypeDescription
min
number
max
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; }
static

withSliderStep()

Slider with step value Use when testing slider steps

Presentation
static withSliderStep(step: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
Parameters
NameTypeDescription
step
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; }
static

withSliderThumbLabel()

Slider with thumb label Use when testing thumb label display

Presentation
static withSliderThumbLabel(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; }
static

withSliderTickMarks()

Slider with tick marks Use when testing tick mark display

Presentation
static withSliderTickMarks(tickInterval: number): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; };
Parameters
NameTypeDescription
tickInterval
number
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: number; }; }
static

withTabIndex()

Single field with tabIndex Use when testing tab order

Presentation
static withTabIndex(tabIndex: number, fieldType: "input" | "textarea" = 'input'): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; };
Parameters
NameTypeDescription
tabIndex
number
fieldType
"input" | "textarea"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string; }; }
static

withToggle()

Single toggle Use when testing toggle rendering

Presentation
static withToggle(): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withToggleColor()

Toggle with color Use when testing Material color theme

Presentation
static withToggleColor(color: "primary" | "accent" | "warn"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Parameters
NameTypeDescription
color
"primary" | "accent" | "warn"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withToggleLabelPosition()

Toggle with label position Use when testing toggle label positioning

Presentation
static withToggleLabelPosition(labelPosition: "before" | "after"): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; };
Parameters
NameTypeDescription
labelPosition
"before" | "after"
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: boolean; }; }
static

withValue()

Single field with initial value Use when testing value binding and updates

Presentation
static withValue(value: string | number | boolean): { config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean; }; };
Parameters
NameTypeDescription
value
string | number | boolean
Returns
{ config: FormConfig<RegisteredFieldTypes[], { [x: string]: Record<string, unknown>; }>; initialValue: { field: string | number | boolean; }; }