22 lines
857 B
PHP
22 lines
857 B
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Blade;
|
|
use IriksIT\Manager\Tests\StatisticsOnTestCase;
|
|
|
|
uses(StatisticsOnTestCase::class);
|
|
|
|
it('serves the script for the public pages, without cookies or a session', function () {
|
|
$response = $this->get('/pulse/pulse.js')->assertOk()->assertHeader('Content-Type', 'application/javascript');
|
|
$script = $response->getFile()->getContent();
|
|
|
|
expect($script)->toContain('/view', '/leave', 'doNotTrack', 'globalPrivacyControl', "credentials: 'omit'")
|
|
->and($response->headers->get('Set-Cookie'))->toBeNull();
|
|
});
|
|
|
|
it('has a component that puts the script in a page', function () {
|
|
$html = Blade::render('<x-manager::pulse />');
|
|
|
|
expect(trim($html))->toBe('<script src="/pulse/pulse.js" defer ></script>');
|
|
expect(Blade::render('<x-manager::pulse :spa="true" />'))->toContain('data-spa');
|
|
});
|