Assert for custom form validation values

An example would be from the filament docs:
TextInput::make('slug')->rules([
    function () {
        return function (string $attribute, $value, Closure $fail) {
            if ($value === 'foo') {
                $fail('The :attribute is invalid.');
            }
        };
    },
])


How can I assert for this particular validation when testing forms? I'm not sure what name to use.
Solution
Got it. I could output the errors with
$component->errors();


I can then check the validation error I want from there.
Was this page helpful?