Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Filament/Resources/ArticleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Filament\Forms\Components\MarkdownEditor;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Set;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/PluginBundleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function form(Schema $schema): Schema
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (string $state, Forms\Set $set): void {
->afterStateUpdated(function (string $state, Schemas\Components\Utilities\Set $set): void {
$set('slug', Str::slug($state));
}),

Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function form(Schema $schema): Schema
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (string $state, Forms\Set $set): void {
->afterStateUpdated(function (string $state, Schemas\Components\Utilities\Set $set): void {
$set('slug', Str::slug($state));
}),

Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/ShowcaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function form(Schema $schema): Schema
->live(),

Schemas\Components\Fieldset::make('Mobile Links')
->visible(fn (Forms\Get $get) => $get('has_mobile'))
->visible(fn (Schemas\Components\Utilities\Get $get) => $get('has_mobile'))
->schema([
Forms\Components\TextInput::make('app_store_url')
->label('App Store URL')
Expand All @@ -86,7 +86,7 @@ public static function form(Schema $schema): Schema
]),

Schemas\Components\Fieldset::make('Desktop Downloads')
->visible(fn (Forms\Get $get) => $get('has_desktop'))
->visible(fn (Schemas\Components\Utilities\Get $get) => $get('has_desktop'))
->schema([
Forms\Components\TextInput::make('windows_download_url')
->label('Windows Download URL')
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/WallOfLoveSubmissionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ public static function form(Schema $schema): Schema
Forms\Components\Toggle::make('promoted')
->label('Promoted to Homepage')
->helperText('Promoted submissions appear in the feedback section on the homepage.')
->visible(fn (Forms\Get $get) => $get('is_approved'))
->visible(fn (Schemas\Components\Utilities\Get $get) => $get('is_approved'))
->live(),

Forms\Components\Textarea::make('promoted_testimonial')
->label('Promoted Testimonial (optional override)')
->helperText('Leave empty to use the original testimonial, or enter a clipped version for the homepage.')
->rows(4)
->visible(fn (Forms\Get $get) => $get('is_approved') && $get('promoted')),
->visible(fn (Schemas\Components\Utilities\Get $get) => $get('is_approved') && $get('promoted')),
])
->columns(1),
]);
Expand Down
62 changes: 62 additions & 0 deletions tests/Feature/Filament/WallOfLoveSubmissionResourceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace Tests\Feature\Filament;

use App\Filament\Resources\WallOfLoveSubmissionResource\Pages\EditWallOfLoveSubmission;
use App\Filament\Resources\WallOfLoveSubmissionResource\Pages\ListWallOfLoveSubmissions;
use App\Models\User;
use App\Models\WallOfLoveSubmission;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
use Tests\TestCase;

class WallOfLoveSubmissionResourceTest extends TestCase
{
use RefreshDatabase;

private User $admin;

protected function setUp(): void
{
parent::setUp();

$this->admin = User::factory()->create(['email' => 'admin@test.com']);
config(['filament.users' => ['admin@test.com']]);
}

public function test_list_page_renders_successfully(): void
{
WallOfLoveSubmission::factory()->count(3)->create();

Livewire::actingAs($this->admin)
->test(ListWallOfLoveSubmissions::class)
->assertSuccessful();
}

public function test_edit_page_renders_for_approved_submission(): void
{
$submission = WallOfLoveSubmission::factory()->approved()->create();

Livewire::actingAs($this->admin)
->test(EditWallOfLoveSubmission::class, ['record' => $submission->getRouteKey()])
->assertSuccessful();
}

public function test_edit_page_renders_for_pending_submission(): void
{
$submission = WallOfLoveSubmission::factory()->pending()->create();

Livewire::actingAs($this->admin)
->test(EditWallOfLoveSubmission::class, ['record' => $submission->getRouteKey()])
->assertSuccessful();
}

public function test_edit_page_renders_for_promoted_submission(): void
{
$submission = WallOfLoveSubmission::factory()->approved()->promoted()->create();

Livewire::actingAs($this->admin)
->test(EditWallOfLoveSubmission::class, ['record' => $submission->getRouteKey()])
->assertSuccessful();
}
}
Loading