diff --git a/src/Elements/Element.php b/src/Elements/Element.php index 760ec2e..9ba3240 100644 --- a/src/Elements/Element.php +++ b/src/Elements/Element.php @@ -105,6 +105,16 @@ public static function registerElementMutator(callable $mutator): void self::$element_mutators[static::class][] = $mutator; } + /** + * Reset element mutators + * + * Resets all element mutators. Useful for testing. + */ + public static function resetElementMutators(): void + { + self::$element_mutators = []; + } + /** * Set a data attribute * diff --git a/src/Support/AireServiceProvider.php b/src/Support/AireServiceProvider.php index 8f359e4..8b3eb8c 100755 --- a/src/Support/AireServiceProvider.php +++ b/src/Support/AireServiceProvider.php @@ -4,6 +4,7 @@ use Galahad\Aire\Aire; use Galahad\Aire\Elements\ClientValidation; +use Galahad\Aire\Elements\Element; use Galahad\Aire\Elements\Form; use Illuminate\Contracts\Foundation\Application; use Illuminate\Support\Facades\Blade; @@ -67,6 +68,7 @@ public function boot() $this->app->terminating(function() { ClientValidation::reset(); + Element::resetElementMutators(); }); }