mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Scraped titles run to hundreds of characters, so the view page heading
wrapped to eight lines and Filament's sm:items-center left the header
actions floating in the middle of it.
- Clamp the heading to 2 lines (3 from md) with the full title on hover,
via getHeading() so the browser tab title stays plain text.
- Align the header actions to the top of the heading on the product view.
- Strip the site name noise stores append to titles ("...: Mice:
Amazon.com.au") on save, using the store name where it is known.
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Filament;
|
|
|
|
use App\Filament\Resources\ProductResource;
|
|
use App\Models\Product;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ViewProductHeadingTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
const LONG_TITLE = 'DAREU A950GM Wireless Gaming Mouse (Black), 60g ultra-lightweight ergonomic design with USB-C, 2.4GHz and Bluetooth tri-mode connectivity, PAW3395 sensor and CX52850 MCU';
|
|
|
|
public function test_long_heading_is_clamped_but_keeps_the_full_title_on_hover(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
$this->actingAs($user);
|
|
|
|
$product = Product::factory()->create([
|
|
'user_id' => $user->getKey(),
|
|
'title' => self::LONG_TITLE,
|
|
]);
|
|
|
|
$response = $this->get(ProductResource::getUrl('view', ['record' => $product]));
|
|
|
|
$response->assertOk();
|
|
$response->assertSee('line-clamp-2', false);
|
|
$response->assertSee('title="'.e(self::LONG_TITLE).'"', false);
|
|
}
|
|
}
|