|
|
@@ -1263,24 +1263,24 @@ describe('command launcher chrome and control seats', () => {
|
|
|
}
|
|
|
const { view } = bench({ permissions, command })
|
|
|
const trigger = view.getByLabelText(/^访问模式/) as HTMLButtonElement
|
|
|
- // Title-case display is presentation only; the menu ids stay machine names.
|
|
|
- expect(trigger.textContent).toBe('Read Only')
|
|
|
+ // Product-label display is presentation only; the menu ids stay machine names.
|
|
|
+ expect(trigger.textContent).toBe('仅可查看')
|
|
|
expect([...trigger.querySelectorAll('svg')]
|
|
|
.every(icon => icon.closest('[aria-hidden="true"]') !== null)).toBe(true)
|
|
|
fireEvent.click(trigger)
|
|
|
const items = view.getAllByRole('menuitem')
|
|
|
- expect(items.map(o => o.textContent)).toEqual(['Read Only', 'Workspace Write', 'Full access'])
|
|
|
+ expect(items.map(o => o.textContent)).toEqual(['仅可查看', '可写入工作区', '完全权限'])
|
|
|
fireEvent.click(items[1]!)
|
|
|
// Optimistic pick + disable until admission resolves (command stub resolves true).
|
|
|
const busy = view.getByLabelText(/^访问模式/) as HTMLButtonElement
|
|
|
- expect(busy.textContent).toBe('Workspace Write')
|
|
|
+ expect(busy.textContent).toBe('可写入工作区')
|
|
|
expect(busy.disabled).toBe(true)
|
|
|
expect(command).toHaveBeenCalledWith('/permission workspace-write')
|
|
|
await act(async () => {})
|
|
|
expect((view.getByLabelText(/^访问模式/) as HTMLButtonElement).disabled).toBe(false)
|
|
|
})
|
|
|
|
|
|
- it('requires explicit risk acknowledgement before submitting Full access', async () => {
|
|
|
+ it('requires explicit risk acknowledgement before submitting full access', async () => {
|
|
|
const command = vi.fn(() => Promise.resolve(true))
|
|
|
const permissions = {
|
|
|
options: [
|
|
|
@@ -1291,11 +1291,11 @@ describe('command launcher chrome and control seats', () => {
|
|
|
}
|
|
|
const { view } = bench({ permissions, command })
|
|
|
fireEvent.click(view.getByLabelText(/^访问模式/))
|
|
|
- fireEvent.click(view.getByRole('menuitem', { name: 'Full access' }))
|
|
|
+ fireEvent.click(view.getByRole('menuitem', { name: '完全权限' }))
|
|
|
|
|
|
expect(command).not.toHaveBeenCalled()
|
|
|
- expect(view.getByRole('dialog', { name: '确认启用 Full access?' })).toBeTruthy()
|
|
|
- const enable = view.getByRole('button', { name: '启用 Full access' }) as HTMLButtonElement
|
|
|
+ expect(view.getByRole('dialog', { name: '确认启用完全权限?' })).toBeTruthy()
|
|
|
+ const enable = view.getByRole('button', { name: '启用完全权限' }) as HTMLButtonElement
|
|
|
expect(enable.disabled).toBe(true)
|
|
|
|
|
|
fireEvent.click(view.getByRole('checkbox', { name: '我已了解风险,并愿意继续' }))
|
|
|
@@ -1305,11 +1305,11 @@ describe('command launcher chrome and control seats', () => {
|
|
|
expect(command).toHaveBeenCalledOnce()
|
|
|
expect(command).toHaveBeenCalledWith('/permission danger-full-access')
|
|
|
expect(view.queryByRole('dialog')).toBeNull()
|
|
|
- expect((view.getByLabelText(/^访问模式/) as HTMLButtonElement).textContent).toBe('Full access')
|
|
|
+ expect((view.getByLabelText(/^访问模式/) as HTMLButtonElement).textContent).toBe('完全权限')
|
|
|
await act(async () => {})
|
|
|
})
|
|
|
|
|
|
- it('cancels a Full access selection without changing permission and resets acknowledgement', () => {
|
|
|
+ it('cancels a full access selection without changing permission and resets acknowledgement', () => {
|
|
|
const command = vi.fn(() => Promise.resolve(true))
|
|
|
const permissions = {
|
|
|
options: [
|
|
|
@@ -1321,21 +1321,21 @@ describe('command launcher chrome and control seats', () => {
|
|
|
const { view } = bench({ permissions, command })
|
|
|
const openConfirmation = () => {
|
|
|
fireEvent.click(view.getByLabelText(/^访问模式/))
|
|
|
- fireEvent.click(view.getByRole('menuitem', { name: 'Full access' }))
|
|
|
+ fireEvent.click(view.getByRole('menuitem', { name: '完全权限' }))
|
|
|
}
|
|
|
|
|
|
openConfirmation()
|
|
|
fireEvent.click(view.getByRole('checkbox'))
|
|
|
fireEvent.click(view.getByRole('button', { name: '取消' }))
|
|
|
expect(command).not.toHaveBeenCalled()
|
|
|
- expect((view.getByLabelText(/^访问模式/) as HTMLButtonElement).textContent).toBe('Workspace Write')
|
|
|
+ expect((view.getByLabelText(/^访问模式/) as HTMLButtonElement).textContent).toBe('可写入工作区')
|
|
|
|
|
|
openConfirmation()
|
|
|
expect((view.getByRole('checkbox') as HTMLInputElement).checked).toBe(false)
|
|
|
- expect((view.getByRole('button', { name: '启用 Full access' }) as HTMLButtonElement).disabled).toBe(true)
|
|
|
+ expect((view.getByRole('button', { name: '启用完全权限' }) as HTMLButtonElement).disabled).toBe(true)
|
|
|
})
|
|
|
|
|
|
- it('revokes an open Full access confirmation when the task locks', () => {
|
|
|
+ it('revokes an open full access confirmation when the task locks', () => {
|
|
|
const command = vi.fn(() => Promise.resolve(true))
|
|
|
const permissions = {
|
|
|
options: [
|
|
|
@@ -1346,14 +1346,14 @@ describe('command launcher chrome and control seats', () => {
|
|
|
}
|
|
|
const { view, session } = bench({ permissions, command })
|
|
|
fireEvent.click(view.getByLabelText(/^访问模式/))
|
|
|
- fireEvent.click(view.getByRole('menuitem', { name: 'Full access' }))
|
|
|
+ fireEvent.click(view.getByRole('menuitem', { name: '完全权限' }))
|
|
|
fireEvent.click(view.getByRole('checkbox'))
|
|
|
act(() => { session.set(snapshotOf({ removed: true })) })
|
|
|
expect(view.queryByRole('dialog')).toBeNull()
|
|
|
expect(command).not.toHaveBeenCalled()
|
|
|
})
|
|
|
|
|
|
- it('resets an open Full access confirmation when switching tasks', () => {
|
|
|
+ it('resets an open full access confirmation when switching tasks', () => {
|
|
|
const command = vi.fn(() => Promise.resolve(true))
|
|
|
const permissions = {
|
|
|
options: [
|
|
|
@@ -1364,7 +1364,7 @@ describe('command launcher chrome and control seats', () => {
|
|
|
}
|
|
|
const { view, props } = bench({ permissions, command })
|
|
|
fireEvent.click(view.getByLabelText(/^访问模式/))
|
|
|
- fireEvent.click(view.getByRole('menuitem', { name: 'Full access' }))
|
|
|
+ fireEvent.click(view.getByRole('menuitem', { name: '完全权限' }))
|
|
|
fireEvent.click(view.getByRole('checkbox'))
|
|
|
view.rerender(<InputBar {...props} sessionId={'s2' as SessionId} />)
|
|
|
expect(view.queryByRole('dialog')).toBeNull()
|