GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): describe permission-blocked add-project submit · pingdotgg/t3code@c7e32d7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src/components
    • CommandPalette.composition.browser.test.tsx
    • CommandPalette.tsx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/CommandPalette.composition.browser.test.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/CommandPalette.composition.browser.test.tsx
+32-8Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ import { describe, expect, it, vi } from "vite-plus/test";
22
import { page, userEvent } from "vite-plus/test/browser";
33
import { DEFAULT_RESOLVED_KEYBINDINGS } from "@t3tools/shared/keybindings";
44
import { DEFAULT_CLIENT_SETTINGS } from "@t3tools/contracts/settings";
5+
import { AuthOrchestrationOperateScope, AuthSourceControlWriteScope } from "@t3tools/contracts";
56
import { act, render } from "../../test/render";
67
import { CommandPalette } from "./CommandPalette";
78
import { openCommandPalette } from "../commandPaletteBus";
89
import { primaryServerKeybindingsAtom } from "../state/server";
910

11+
const scopes = vi.hoisted(() => ({ denied: undefined as string | undefined }));
12+
const setup = (deniedScope?: string) => {
13+
scopes.denied = deniedScope;
14+
};
15+
1016
vi.mock("@effect/atom-react", async (original) => ({
1117
...(await original<typeof import("@effect/atom-react")>()),
1218
useAtomValue: (atom: unknown) =>
@@ -85,7 +91,7 @@ vi.mock("../state/queries", async (original) => ({
8591
}));
8692
vi.mock("../state/session", async (original) => ({
8793
...(await original<typeof import("../state/session")>()),
88-
useEnvironmentScope: () => true,
94+
useEnvironmentScope: (_environmentId: unknown, scope: string) => scope !== scopes.denied,
8995
readEnvironmentScope: () => true,
9096
}));
9197
vi.mock("../state/filesystem", async (original) => ({
@@ -145,13 +151,31 @@ it.each([
145151
},
146152
{ step: "repository", source: "Git URL", keys: "", description: /Continue.*Enter/ },
147153
{ step: "new project", source: "New project", keys: "", description: /Create.*Enter/ },
148-
])("tells screen readers how to submit the $step step", async ({ source, keys, description }) => {
149-
await using _screen = await render(<CommandPalette>{null}</CommandPalette>);
150-
await act(() => openCommandPalette({ open: "add-project" }));
151-
await page.getByText(source, { exact: true }).click();
152-
if (keys) await userEvent.keyboard(keys);
153-
await expect.element(page.getByRole("combobox")).toHaveAccessibleDescription(description);
154-
});
154+
{
155+
step: "permission-blocked folder",
156+
source: "Local folder",
157+
keys: "",
158+
deniedScope: AuthOrchestrationOperateScope,
159+
description: "This connection cannot add projects.",
160+
},
161+
{
162+
step: "permission-blocked destination",
163+
source: "Git URL",
164+
keys: "https://example.com/team/project.git{Enter}",
165+
deniedScope: AuthSourceControlWriteScope,
166+
description: "This connection needs permission to write source control and add projects.",
167+
},
168+
])(
169+
"tells screen readers how to submit the $step step",
170+
async ({ source, keys, deniedScope, description }) => {
171+
setup(deniedScope);
172+
await using _screen = await render(<CommandPalette>{null}</CommandPalette>);
173+
await act(() => openCommandPalette({ open: "add-project" }));
174+
await page.getByText(source, { exact: true }).click();
175+
if (keys) await userEvent.keyboard(keys);
176+
await expect.element(page.getByRole("combobox")).toHaveAccessibleDescription(description);
177+
},
178+
);
155179

156180
it("keeps the caret in place when an edit briefly makes the folder path not a path", async () => {
157181
await using _screen = await render(<CommandPalette>{null}</CommandPalette>);
Collapse file

‎apps/web/src/components/CommandPalette.tsx‎

Copy file name to clipboardExpand all lines: apps/web/src/components/CommandPalette.tsx
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2786,6 +2786,12 @@ function OpenCommandPaletteDialog(props: {
27862786
};
27872787

27882788
const submitButtonId = useId();
2789+
const browseSubmitLabel =
2790+
isCloneDestinationStep && !canCloneProject
2791+
? "This connection needs permission to write source control and add projects."
2792+
: canCreateProject
2793+
? `${submitActionLabel} (${addShortcutLabel})`
2794+
: "This connection cannot add projects.";
27892795
const inputAccessory =
27902796
newProjectFlow !== null ? (
27912797
<CommandPaletteSubmitButton
@@ -2816,14 +2822,8 @@ function OpenCommandPaletteDialog(props: {
28162822
id={submitButtonId}
28172823
label={isCloneDestinationStep && isRemoteProjectPending ? "Cloning" : submitActionLabel}
28182824
shortcutLabel={addShortcutLabel}
2819-
ariaLabel={`${submitActionLabel} (${addShortcutLabel})`}
2820-
tooltip={
2821-
isCloneDestinationStep && !canCloneProject
2822-
? "This connection needs permission to write source control and add projects."
2823-
: canCreateProject
2824-
? `${submitActionLabel} (${addShortcutLabel})`
2825-
: "This connection cannot add projects."
2826-
}
2825+
ariaLabel={browseSubmitLabel}
2826+
tooltip={browseSubmitLabel}
28272827
disabled={
28282828
!canCreateProject ||
28292829
!canCreateProjectInEnvironment(browseEnvironment?.connection.phase) ||

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.