fix: Testing wizard startOnStep()

This commit is contained in:
Dan Harrin
2025-06-22 17:35:31 +01:00
parent f62fea99ec
commit 7f9a6aaccf
+2 -4
View File
@@ -30,7 +30,7 @@ class Wizard extends Component
protected int | Closure $startStep = 1;
protected int $currentStepIndex = 0;
protected ?int $currentStepIndex = null;
/**
* @var view-string
@@ -60,8 +60,6 @@ class Wizard extends Component
{
parent::setUp();
$this->setCurrentStepIndex($this->getStartStep() - 1);
$this->registerActions([
fn (Wizard $component): Action => $component->getNextAction(),
fn (Wizard $component): Action => $component->getPreviousAction(),
@@ -268,7 +266,7 @@ class Wizard extends Component
public function getCurrentStepIndex(): int
{
return $this->currentStepIndex;
return $this->currentStepIndex ??= ($this->getStartStep() - 1);
}
protected function setCurrentStepIndex(int $index): static