Skip to content

Commit

Permalink
remove HTML encoding from step rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
satoved committed Sep 24, 2024
1 parent 52a7875 commit efcc718
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/Livewire/WizardComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Satoved\LivewireSteps\Livewire;

use Illuminate\Support\Facades\Blade;
use Illuminate\Support\HtmlString;
use Livewire\Component;
use ReflectionClass;
use ReflectionNamedType;
Expand Down Expand Up @@ -80,11 +81,13 @@ public function stepIndexById(string $stepId): int

public function renderStep()
{
return Blade::render(<<<'BLADE'
<div wire:key="wizard-step-{{ $this->currentStep()->id() }}">
{!! $this->currentStep()->render() !!}
</div>
return new HtmlString(
Blade::render(<<<'BLADE'
<div wire:key="wizard-step-{{ $this->currentStep()->id() }}">
{!! $this->currentStep()->render() !!}
</div>
BLADE
)
);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/WizardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit efcc718

Please sign in to comment.