diff --git a/resources/views/livewire/device-dashboard.blade.php b/resources/views/livewire/device-dashboard.blade.php index 76ce414..5db65d1 100644 --- a/resources/views/livewire/device-dashboard.blade.php +++ b/resources/views/livewire/device-dashboard.blade.php @@ -95,7 +95,11 @@ new class extends Component { @elseif($current_image_path) - Current Image +
+
+ Current Image +
+
@endif diff --git a/resources/views/livewire/devices/configure.blade.php b/resources/views/livewire/devices/configure.blade.php index 488e904..32a16f6 100644 --- a/resources/views/livewire/devices/configure.blade.php +++ b/resources/views/livewire/devices/configure.blade.php @@ -455,7 +455,11 @@ new class extends Component { @if(!$device->mirror_device_id) @if($current_image_path) - Next Image +
+
+ Next Image +
+
@endif diff --git a/tests/Feature/DeviceConfigureTest.php b/tests/Feature/Devices/DeviceConfigureTest.php similarity index 100% rename from tests/Feature/DeviceConfigureTest.php rename to tests/Feature/Devices/DeviceConfigureTest.php diff --git a/tests/Feature/Devices/DeviceRotationTest.php b/tests/Feature/Devices/DeviceRotationTest.php new file mode 100644 index 0000000..2f2374f --- /dev/null +++ b/tests/Feature/Devices/DeviceRotationTest.php @@ -0,0 +1,86 @@ +create(); + $device = Device::factory()->create([ + 'user_id' => $user->id, + 'rotate' => 90, + 'current_screen_image' => 'test-image-uuid', + ]); + + // Mock the file existence check + \Illuminate\Support\Facades\Storage::fake('public'); + \Illuminate\Support\Facades\Storage::disk('public')->put('images/generated/test-image-uuid.png', 'fake-image-content'); + + $response = $this->actingAs($user) + ->get(route('dashboard')); + + $response->assertSuccessful(); + $response->assertSee('-rotate-[90deg]'); + $response->assertSee('origin-center'); +}); + +test('device configure page shows device image with correct rotation', function () { + $user = User::factory()->create(); + $device = Device::factory()->create([ + 'user_id' => $user->id, + 'rotate' => 90, + 'current_screen_image' => 'test-image-uuid', + ]); + + // Mock the file existence check + \Illuminate\Support\Facades\Storage::fake('public'); + \Illuminate\Support\Facades\Storage::disk('public')->put('images/generated/test-image-uuid.png', 'fake-image-content'); + + $response = $this->actingAs($user) + ->get(route('devices.configure', $device)); + + $response->assertSuccessful(); + $response->assertSee('-rotate-[90deg]'); + $response->assertSee('origin-center'); +}); + +test('device with no rotation shows no transform style', function () { + $user = User::factory()->create(); + $device = Device::factory()->create([ + 'user_id' => $user->id, + 'rotate' => 0, + 'current_screen_image' => 'test-image-uuid', + ]); + + // Mock the file existence check + \Illuminate\Support\Facades\Storage::fake('public'); + \Illuminate\Support\Facades\Storage::disk('public')->put('images/generated/test-image-uuid.png', 'fake-image-content'); + + $response = $this->actingAs($user) + ->get(route('dashboard')); + + $response->assertSuccessful(); + $response->assertSee('-rotate-[0deg]'); +}); + +test('device with null rotation defaults to 0', function () { + $user = User::factory()->create(); + $device = Device::factory()->create([ + 'user_id' => $user->id, + 'rotate' => null, + 'current_screen_image' => 'test-image-uuid', + ]); + + // Mock the file existence check + \Illuminate\Support\Facades\Storage::fake('public'); + \Illuminate\Support\Facades\Storage::disk('public')->put('images/generated/test-image-uuid.png', 'fake-image-content'); + + $response = $this->actingAs($user) + ->get(route('dashboard')); + + $response->assertSuccessful(); + $response->assertSee('-rotate-[0deg]'); +});