Skip to content

Commit

Permalink
fix: test use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
discoverlance-com committed Feb 19, 2023
1 parent 83f33ea commit 847424d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
"spatie/laravel-package-tools": "^1.14.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"laravel-lang/attributes": "^2.0",
"laravel-lang/lang": "^12.0",
"laravel-lang/publisher": "^14.0",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^7.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"pestphp/pest-plugin-livewire": "^1.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand Down
3 changes: 3 additions & 0 deletions resources/views/components/link.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<x-filament-support::link :attributes="\Filament\Support\prepare_inherited_attributes($attributes)" :dark-mode="config('notifications.dark_mode')">
{{ $slot }}
</x-filament-support::link>
12 changes: 3 additions & 9 deletions resources/views/components/modal/actions.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<div {{ $attributes }}>
<div class="mt-2 text-sm">
<x-filament::link
x-on:click="$dispatch('open-modal', { id: 'create-hint' })"
color="secondary"
tag="button"
tabindex="-1"
wire:loading.attr="disabled"
wire:loading.class="opacity-70 cursor-wait"
>
<x-filament-page-hints::link x-on:click="$dispatch('open-modal', { id: 'create-hint' })" color="secondary"
tag="button" tabindex="-1" wire:loading.attr="disabled" wire:loading.class="opacity-70 cursor-wait">
{{ __('filament-page-hints::translations.modal.buttons.create.label') }}
</x-filament::link>
</x-filament-page-hints::link>

<span>
&bull;
Expand Down
8 changes: 4 additions & 4 deletions resources/views/components/modal/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="flex justify-between gap-2 flex-wrap">
<p class="text-xl font-bold">{{ $hint->title }}</p>
<div>
<x-filament::link
<x-filament-page-hints::link
x-on:click="
$wire.editPageHint('{{ $hint->uuid }}')
.then(() => $dispatch('open-modal', { id: 'create-hint' }))
Expand All @@ -31,22 +31,22 @@ class="text-sm" color="{{ config('filament-page-hints.upsert_hint_button_color')
wire:target="editPageHint" tag="button" wire:loading.attr="disabled"
wire:loading.class="opacity-70 cursor-wait">
{{ __('filament-page-hints::translations.modal.buttons.edit.label') }}
</x-filament::link>
</x-filament-page-hints::link>

<span>
&bull;
</span>
</div>
<div>
<x-filament::link
<x-filament-page-hints::link
x-on:click="
await $wire.deletePageHint('{{ $hint->uuid }}')
"
class="text-sm" color="{{ config('filament-page-hints.delete_hint_button_color') }}"
wire:target="deletePageHint" tag="button" wire:loading.attr="disabled"
wire:loading.class="opacity-70 cursor-wait">
{{ __('filament-page-hints::translations.modal.buttons.delete.label') }}
</x-filament::link>
</x-filament-page-hints::link>
</div>
</div>
<div @class([
Expand Down
21 changes: 17 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use Discoverlance\FilamentPageHints\FilamentPageHintsServiceProvider;
use Discoverlance\FilamentPageHints\Http\Livewire\PageHints;
use Filament\FilamentServiceProvider;
use Livewire\Livewire;
use Livewire\LivewireServiceProvider;

class TestCase extends Orchestra
{
Expand All @@ -13,24 +17,33 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Discoverlance\\FilamentPageHints\\Database\\Factories\\'.class_basename($modelName).'Factory'
fn (string $modelName) => 'Discoverlance\\FilamentPageHints\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
);

// $this->registerLivewireComponents();
}

protected function registerLivewireComponents(): self
{
Livewire::component('page-hints', PageHints::class);
return $this;
}

protected function getPackageProviders($app)
{
return [
LivewireServiceProvider::class,
FilamentServiceProvider::class,
FilamentPageHintsServiceProvider::class,

];
}

public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');

/*
$migration = include __DIR__.'/../database/migrations/create_filament-page-hints_table.php.stub';
$migration = include __DIR__ . '/../database/migrations/create_filament_page_hints_table.php.stub';
$migration->up();
*/
}
}

0 comments on commit 847424d

Please sign in to comment.