Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
satoved committed Sep 25, 2024
1 parent 8f2e5b5 commit df6057f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Lightweight Livewire component that allow you to easily build a wizard (multi-st

This package utilizes [Livewire 3 forms objects](https://livewire.laravel.com/docs/forms#extracting-a-form-object) as steps and needs only one Livewire component as a Wizard.

![screenshot](https://github.com/satoved/laravel-livewire-steps/blob/main/docs/images/demo-screenshot.png?raw=true)

Here's what a wizard could look like.

In [this repo on GitHub](https://github.com/satoved/laravel-livewire-steps-demo), you'll find a demo Laravel application that uses the laravel-livewire-steps package to create a simple email subscription flow.

## Installation

You can install the package via composer:
Expand Down
13 changes: 11 additions & 2 deletions tests/WizardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Satoved\LivewireSteps\Exceptions\NoNextStep;
use Satoved\LivewireSteps\Livewire\WizardComponent;
use Satoved\LivewireSteps\Tests\TestSupport\MyWizardComponent;
use Satoved\LivewireSteps\Tests\TestSupport\Steps\FirstStepForm;
use Satoved\LivewireSteps\Tests\TestSupport\Steps\SecondStepForm;
use Satoved\LivewireSteps\Tests\TestSupport\Steps\SomeIntricateNameStepForm;

Expand Down Expand Up @@ -48,6 +49,15 @@
->assertSee('__SECOND_STEP_BODY__');
});

it('can go to a specific step backwards', function () {
Livewire::test(MyWizardComponent::class)
->call('nextStep')
->assertSet('currentStepIndex', 1)
->call('toStep', FirstStepForm::id())
->assertSet('currentStepIndex', 0)
->assertSee('__FIRST_STEP_BODY__');
});

it('adds unique wire:key to steps', function () {
Livewire::test(MyWizardComponent::class)
->assertSeeHtml(' wire:key="wizard-step-FirstStepForm"')
Expand All @@ -56,8 +66,7 @@
});

it('has default labels for steps', function () {
$class = new class extends WizardComponent
{
$class = new class extends WizardComponent {
public SomeIntricateNameStepForm $someIntricateNameStepForm;

public function render()
Expand Down

0 comments on commit df6057f

Please sign in to comment.