-
-
Notifications
You must be signed in to change notification settings - Fork 216
Expand file tree
/
Copy pathMetricsDashboardSectionManagementTest.php
More file actions
69 lines (53 loc) · 2.28 KB
/
MetricsDashboardSectionManagementTest.php
File metadata and controls
69 lines (53 loc) · 2.28 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
it('renders all sections by default', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee('Speed', false);
$response->assertSee('Ping', false);
$response->assertSee('Latency (IQM)', false);
$response->assertSee('Jitter', false);
});
it('includes section management UI in filter modal', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee('Manage Sections', false);
$response->assertSee('Drag to reorder', false);
$response->assertSee('Reset to Default Order', false);
});
it('includes Alpine sort directive in rendered view', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee('x-sort', false);
$response->assertSee('sectionManager()', false);
$response->assertSee('dashboardSections()', false);
});
it('includes all four sections in sortable list', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee("id: 'speed'", false);
$response->assertSee("id: 'ping'", false);
$response->assertSee("id: 'latency'", false);
$response->assertSee("id: 'jitter'", false);
});
it('includes localStorage preference loading logic', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee("localStorage.getItem('metrics-dashboard-preferences')", false);
});
it('includes default preferences fallback', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee("sectionOrder: ['speed', 'ping', 'latency', 'jitter']", false);
$response->assertSee('hiddenSections: []', false);
});
it('dispatches event when preferences change', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee("window.dispatchEvent(new CustomEvent('dashboard-preferences-changed'", false);
});
it('includes validation for corrupted preferences', function () {
$response = $this->get(route('dashboard'));
$response->assertSuccessful();
$response->assertSee('try {', false);
$response->assertSee('catch (e)', false);
});