Joel Beer
Joel Beer
FFilament
Created by Joel Beer on 4/19/2024 in #❓┊help
Form Wizard not displaying "next" button when conditional steps are added
When conditionally adding steps to the Form Wizard (https://filamentphp.com/docs/3.x/forms/layout/wizard) The "Next" step action does not respect the conditionals. As seen in the screen recording the step is conditionally added and is visible as part of the steps across the top of the page but the "Next" button does not appear. It appears that the x-show is not refreshing even though when I have put in a console log within the isLastStep function of the resources/views/components/wizard.blade.php file I can see the value change from true to false. My understanding is that the x-show should add/ remove the display:none from the element depending on the returned value of the isLastStep function. Any help would be very appreciated Example Screen record : https://www.loom.com/share/fdc84260ecf54f4986bd2add308941ad?sid=c1467688-c341-4813-8d8d-b11f8d995dde
2 replies
FFilament
Created by Joel Beer on 3/6/2024 in #❓┊help
How to increase Pest test coverage
Hey, I am attempting to increase my test coverage to 100% for my resources and can't seem to figure it out. For context: - Larvel 10 - Filament v3 - PHP 8.2 - Pest 2.0 I currently have a User resource created with the panel builder and customised to my needs. I have the infolist, form & table methods all completed & the app is working as expected. The issue I have is I for the life of me cannot get my test coverage up on these methods. All my tests for rendering the views, asserting that the components contain the right data / number of rows pass. See examples below. But none of them help in getting the Pest coverage up. Example Pest coverage output. The lines suggested cover the 3 infolist, form & table methods Resources/UserResource ............. 35..105, 34..107 / 12.7% What am I missing? Ive tried several different techniques but can't seem to get the coverage up.
it('can render list', function () {
$this->get(UserResource::getUrl('index'))
->assertSeeLivewire(UserResource\Pages\ListUsers::class)
->assertSuccessful();
});

it('can retrieve data', function () {
$user = User::factory()->create();

livewire(UserResource\Pages\ViewUser::class, [
'record' => $user->getRouteKey(),
])
->assertSee([
$user->first_name,
$user->last_name,
$user->email,
$user->roleName
]);
});

it('can list users', function () {
User::factory()
->count(5)
->create();

livewire(UserResource\Pages\ListUsers::class)
->assertCanSeeTableRecords(User::all())
->assertCanRenderTableColumn('title');
});
it('can render list', function () {
$this->get(UserResource::getUrl('index'))
->assertSeeLivewire(UserResource\Pages\ListUsers::class)
->assertSuccessful();
});

it('can retrieve data', function () {
$user = User::factory()->create();

livewire(UserResource\Pages\ViewUser::class, [
'record' => $user->getRouteKey(),
])
->assertSee([
$user->first_name,
$user->last_name,
$user->email,
$user->roleName
]);
});

it('can list users', function () {
User::factory()
->count(5)
->create();

livewire(UserResource\Pages\ListUsers::class)
->assertCanSeeTableRecords(User::all())
->assertCanRenderTableColumn('title');
});
1 replies