diff --git a/src/Livewire/WizardComponent.php b/src/Livewire/WizardComponent.php
index 477a2c1..8633772 100644
--- a/src/Livewire/WizardComponent.php
+++ b/src/Livewire/WizardComponent.php
@@ -3,6 +3,7 @@
namespace Satoved\LivewireSteps\Livewire;
use Illuminate\Support\Facades\Blade;
+use Illuminate\Support\HtmlString;
use Livewire\Component;
use ReflectionClass;
use ReflectionNamedType;
@@ -80,11 +81,13 @@ public function stepIndexById(string $stepId): int
public function renderStep()
{
- return Blade::render(<<<'BLADE'
-
- {!! $this->currentStep()->render() !!}
-
+ return new HtmlString(
+ Blade::render(<<<'BLADE'
+
+ {!! $this->currentStep()->render() !!}
+
BLADE
+ )
);
}
diff --git a/tests/WizardTest.php b/tests/WizardTest.php
index a5ba6b4..4bcf127 100644
--- a/tests/WizardTest.php
+++ b/tests/WizardTest.php
@@ -48,11 +48,11 @@
->assertSee('__SECOND_STEP_BODY__');
});
-it('can render steps with their states', function () {
+it('adds unique wire:key to steps', function () {
Livewire::test(MyWizardComponent::class)
- ->assertSee('__FIRST_STEP_BODY__')
+ ->assertSeeHtml(' wire:key="wizard-step-44ed6a1c434b0a50b0b1dfe9a3b464ca"')
->call('toStep', SecondStepForm::id())
- ->assertSee('__SECOND_STEP_BODY__');
+ ->assertSeeHtml(' wire:key="wizard-step-478dbf24db14bdd0d8e185357241685a"');
});
it('has default labels for steps', function () {