forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetricsDashboardPersistenceTest.php
More file actions
51 lines (39 loc) · 1.76 KB
/
MetricsDashboardPersistenceTest.php
File metadata and controls
51 lines (39 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
use App\Livewire\MetricsDashboard;
use Livewire\Livewire;
it('initializes with default date range of last 24 hours', function () {
$component = Livewire::test(MetricsDashboard::class);
$startDate = now()->subDay()->format('Y-m-d');
$endDate = now()->format('Y-m-d');
expect($component->get('startDate'))->toBe($startDate);
expect($component->get('endDate'))->toBe($endDate);
});
it('does not include localStorage persistence code in rendered view', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertDontSee('localStorage.getItem(\'metrics-date-range\')', false);
$response->assertDontSee('localStorage.setItem(\'metrics-date-range\'', false);
});
it('includes display settings modal in rendered view', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee('flux:modal.trigger', false);
$response->assertSee('name="displaySettingsModal"', false);
$response->assertSee('Manage Sections', false);
$response->assertSee('Uncheck to hide sections', false);
});
it('does not include sorting functionality in rendered view', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertDontSee('x-sort', false);
$response->assertDontSee('x-sort:item', false);
$response->assertDontSee('x-sort:handle', false);
$response->assertDontSee('grip-vertical', false);
$response->assertDontSee('handleSort', false);
});
it('includes max date constraint in date inputs', function () {
$response = $this->get(route('dashboard'));
$today = now()->format('Y-m-d');
$response->assertSuccessful();
$response->assertSee('max="'.$today.'"', false);
});