fix: emit no badge markup when no badge is ticked
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
9920fafab6
commit
bf365d029f
@@ -100,3 +100,16 @@ test('existing product without new data still renders', function () {
|
||||
|
||||
$this->get(route('products.show', $product))->assertOk();
|
||||
});
|
||||
|
||||
test('badge-less product emits no badge markup on card or show page', function () {
|
||||
$product = Product::factory()->approved()->create();
|
||||
|
||||
$this->get(route('products.show', $product))->assertOk()->assertDontSee('rounded-full text-xs font-medium', false);
|
||||
|
||||
$html = view('components.product.card', ['product' => $product->load(['user', 'category'])])->render();
|
||||
expect($html)->not->toContain('mb-3 flex')
|
||||
->and($html)->not->toContain('gap-1.5');
|
||||
|
||||
$badged = Product::factory()->approved()->create(['eu_made' => true])->load(['user', 'category']);
|
||||
expect(view('components.product.card', ['product' => $badged])->render())->toContain('gap-1.5')->toContain('EU made');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user