Files
ladill-hosting/tests/Feature/ResponsivePaystackSheetTest.php
T
isaacclad f2713c7c23
Deploy Ladill Hosting / deploy (push) Successful in 1m17s
Open Paystack from the Pay click gesture, not after fetch.
Paystack blocks iframes, so checkout uses a popup beside the sheet/modal chrome. Opening about:blank on the user tap keeps that window from being blocked after the async initiate response.
2026-07-21 18:13:44 +00:00

44 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature;
use Tests\TestCase;
class ResponsivePaystackSheetTest extends TestCase
{
public function test_checkout_sheet_partial_has_mobile_sheet_and_desktop_modal(): void
{
$html = view('partials.paystack-sheet', [
'audience' => 'buyer',
])->render();
$this->assertStringContainsString('role="dialog"', $html);
$this->assertStringContainsString('aria-modal="true"', $html);
$this->assertStringContainsString('md:items-center', $html);
$this->assertStringContainsString('rounded-t-2xl', $html);
$this->assertStringContainsString('md:h-[min(720px,85vh)]', $html);
$this->assertStringContainsString('Complete your payment', $html);
$this->assertStringContainsString('safe-area-inset-bottom', $html);
$this->assertStringContainsString('LadillPayCheckout', $html);
$this->assertStringContainsString('Continue to Paystack', $html);
$this->assertStringContainsString('ladill_pay_checkout', $html);
$this->assertStringContainsString('prepare:', $html);
$this->assertStringNotContainsString('Paystack checkout', $html);
}
public function test_payment_return_escapes_popup_and_iframe_to_opener_or_top(): void
{
$html = view('public.payment-return', [
'redirect' => 'https://example.test/paid',
])->render();
$this->assertStringContainsString('Confirming your payment', $html);
$this->assertStringContainsString('window.opener', $html);
$this->assertStringContainsString('window.top.location.replace', $html);
$this->assertTrue(
str_contains($html, 'https://example.test/paid')
|| str_contains($html, 'https:\/\/example.test\/paid')
);
}
}