Skip to content

Commit f856f6e

Browse files
committed
Localization and string-related test fixes
1 parent 95cee18 commit f856f6e

File tree

20 files changed

+76
-29
lines changed

20 files changed

+76
-29
lines changed

webview-ui/src/components/chat/CloudTaskButton.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ export const CloudTaskButton = ({ item, disabled = false }: CloudTaskButtonProps
2525
// Generate the cloud URL for the task
2626
const cloudTaskUrl = item?.id ? `${cloudApiUrl}/task/${item.id}` : ""
2727

28-
// Helper function to generate QR code
2928
const generateQRCode = useCallback(
3029
(canvas: HTMLCanvasElement, context: string) => {
3130
if (!cloudTaskUrl) {
3231
// This will run again later when ready
3332
return
3433
}
3534

36-
console.log(`Generating QR code (${context})`)
3735
QRCode.toCanvas(
3836
canvas,
3937
cloudTaskUrl,
@@ -79,7 +77,6 @@ export const CloudTaskButton = ({ item, disabled = false }: CloudTaskButtonProps
7977
}
8078
}, [dialogOpen, canvasElement, generateQRCode])
8179

82-
// Check if the button should be shown
8380
if (!cloudUserInfo?.extensionBridgeEnabled || !item?.id) {
8481
return null
8582
}
@@ -105,8 +102,9 @@ export const CloudTaskButton = ({ item, disabled = false }: CloudTaskButtonProps
105102
<DialogTitle>{t("chat:task.openInCloud")}</DialogTitle>
106103
</DialogHeader>
107104

108-
<div className="flex flex-col space-y-4 text-center">
109-
<div className="flex justify-center">
105+
<div className="flex flex-col space-y-4">
106+
<p className="text-center md:text-left max-w-80">{t("chat:task.openInCloudIntro")}</p>
107+
<div className="flex justify-center md:justify-start">
110108
<div
111109
className="w-[170px] h-[170px] bg-white rounded-lg border-border cursor-pointer hover:opacity-70 transition-opacity"
112110
onClick={() => vscode.postMessage({ type: "openExternal", url: cloudTaskUrl })}

webview-ui/src/components/chat/__tests__/CloudTaskButton.spec.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ describe("CloudTaskButton", () => {
7070
7171
extensionBridgeEnabled: true,
7272
},
73+
cloudApiUrl: "https://app.roocode.com",
7374
} as any)
7475
})
7576

@@ -88,6 +89,7 @@ describe("CloudTaskButton", () => {
8889
8990
extensionBridgeEnabled: false,
9091
},
92+
cloudApiUrl: "https://app.roocode.com",
9193
} as any)
9294

9395
render(<CloudTaskButton item={mockItem} />)
@@ -98,6 +100,7 @@ describe("CloudTaskButton", () => {
98100
test("does not render when cloudUserInfo is null", () => {
99101
mockUseExtensionState.mockReturnValue({
100102
cloudUserInfo: null,
103+
cloudApiUrl: "https://app.roocode.com",
101104
} as any)
102105

103106
render(<CloudTaskButton item={mockItem} />)
@@ -119,7 +122,7 @@ describe("CloudTaskButton", () => {
119122
fireEvent.click(button)
120123

121124
await waitFor(() => {
122-
expect(screen.getByText("chat:task.continueFromAnywhere")).toBeInTheDocument()
125+
expect(screen.getByText("chat:task.openInCloud")).toBeInTheDocument()
123126
})
124127
})
125128

@@ -136,18 +139,30 @@ describe("CloudTaskButton", () => {
136139
})
137140
})
138141

142+
test("displays intro text in dialog", async () => {
143+
render(<CloudTaskButton item={mockItem} />)
144+
145+
const button = screen.getByTestId("cloud-task-button")
146+
fireEvent.click(button)
147+
148+
await waitFor(() => {
149+
expect(screen.getByText("chat:task.openInCloudIntro")).toBeInTheDocument()
150+
})
151+
})
152+
139153
// Note: QR code generation is tested implicitly through the canvas rendering test below
140154

141-
test("QR code canvas has proper accessibility attributes", async () => {
155+
test("QR code canvas is rendered", async () => {
142156
render(<CloudTaskButton item={mockItem} />)
143157

144158
const button = screen.getByTestId("cloud-task-button")
145159
fireEvent.click(button)
146160

147161
await waitFor(() => {
148-
const canvas = screen.getByLabelText("QR code for cloud task URL")
162+
// Canvas element doesn't have a specific aria label, find it directly
163+
const canvas = document.querySelector("canvas")
149164
expect(canvas).toBeInTheDocument()
150-
expect(canvas.tagName).toBe("CANVAS")
165+
expect(canvas?.tagName).toBe("CANVAS")
151166
})
152167
})
153168

@@ -175,15 +190,15 @@ describe("CloudTaskButton", () => {
175190
fireEvent.click(button)
176191

177192
await waitFor(() => {
178-
expect(screen.getByText("chat:task.continueFromAnywhere")).toBeInTheDocument()
193+
expect(screen.getByText("chat:task.openInCloud")).toBeInTheDocument()
179194
})
180195

181196
// Close dialog by clicking the X button (assuming it exists in Dialog component)
182197
const closeButton = screen.getByRole("button", { name: /close/i })
183198
fireEvent.click(closeButton)
184199

185200
await waitFor(() => {
186-
expect(screen.queryByText("chat:task.continueFromAnywhere")).not.toBeInTheDocument()
201+
expect(screen.queryByText("chat:task.openInCloud")).not.toBeInTheDocument()
187202
})
188203
})
189204

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"shareSuccessOrganization": "Organization link copied to clipboard",
2727
"shareSuccessPublic": "Public link copied to clipboard",
2828
"openInCloud": "Open task in Roo Code Cloud",
29-
"continueFromAnywhere": "Continue from anywhere"
29+
"openInCloudIntro": "Keep monitoring or interacting with Roo from anywhere. Scan, click or copy to open."
3030
},
3131
"unpin": "Unpin",
3232
"pin": "Pin",

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/id/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webview-ui/src/i18n/locales/it/chat.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)