Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(extension): respect recording lock on camera toggle
Akshar Patel5ae4e94ea93c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 3fa00050e..8b749481a 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -114,6 +114,9 @@ jobs:bun test scripts/loops/profile.test.ts scripts/loops/lifecycle.test.tsbun run tsc --noEmit --strict --jsx react-jsx --allowImportingTsExtensions --target ESNext --module ESNext --moduleResolution bundler --resolveJsonModule --types bun --skipLibCheck scripts/loops/*.ts+ - name: Test Chrome extension+ run: bun run --cwd apps/chrome-extension test+- name: Test render farm orchestrationrun: |bun test apps/render-farmdiff --git a/apps/chrome-extension/src/popup/components/camera-selector.test.tsx b/apps/chrome-extension/src/popup/components/camera-selector.test.tsxnew file mode 100644index 000000000..d1c6f91b6--- /dev/null+++ b/apps/chrome-extension/src/popup/components/camera-selector.test.tsx@@ -0,0 +1,38 @@+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it } from "vitest";+import { CameraSelector } from "./camera-selector";++const camera = { deviceId: "camera-1", label: "Camera", groupId: "group-1" };++const renderStatusButton = (disabled: boolean, permissionGranted: boolean) => {+ const markup = renderToStaticMarkup(+ <CameraSelector+ selectedCameraId={camera.deviceId}+ availableCameras={permissionGranted ? [camera] : []}+ permissionGranted={permissionGranted}+ disabled={disabled}+ onCameraChange={() => undefined}+ onRefreshDevices={() => undefined}+ onPermissionBlocked={() => undefined}+ />,+ );+ return markup.match(/<button[^>]*aria-disabled="[^"]*"[^>]*>/)?.[0];+};++describe("camera selector", () => {+ it.each([true, false])(+ "disables the status button when the selector is disabled and permission is %s",+ (permissionGranted) => {+ const button = renderStatusButton(true, permissionGranted);++ expect(button).toMatch(/\sdisabled=/);+ expect(button).toMatch(/aria-disabled="true"/);+ },+ );++ it("keeps the status button available when the selector is enabled", () => {+ const button = renderStatusButton(false, true);+ expect(button).not.toMatch(/\sdisabled=/);+ expect(button).toMatch(/aria-disabled="false"/);+ });+});diff --git a/apps/chrome-extension/src/popup/components/camera-selector.tsx b/apps/chrome-extension/src/popup/components/camera-selector.tsxindex 0d2eab167..69936bdb1 100644--- a/apps/chrome-extension/src/popup/components/camera-selector.tsx+++ b/apps/chrome-extension/src/popup/components/camera-selector.tsx@@ -49,7 +49,8 @@ export const CameraSelector = ({const hasAccess = permissionGranted || availableCameras.length > 0;const shouldRequestPermission = !hasAccess;- const statusPillDisabled = !shouldRequestPermission && !cameraEnabled;+ const statusPillDisabled =+ disabled || (!shouldRequestPermission && !cameraEnabled);const currentValue = selectedCameraId ?? NO_CAMERA_VALUE;