Files
claude-code/src/components/HelpV2/__tests__/General.test.ts
claude-code-best 4d0048a60a fix: 优化权限提示用词和 Help 页面新手引导
- Help General 页添加 3 步 Getting started 引导,替代单段描述
- 权限对话框底部 "Esc to cancel" → "Esc to reject","Tab to amend" → "Tab to add feedback"
- .claude/ 文件夹权限选项标签从 60 字符缩至 49 字符,避免窄终端截断
- 新增 10 个测试覆盖权限提示文案和帮助页引导内容

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 00:09:27 +08:00

75 lines
2.2 KiB
TypeScript

import { describe, expect, test } from 'bun:test'
/**
* Verify that user-facing permission and help copy meets usability standards.
* These are pure string tests — no side effects, no React rendering.
*/
describe('Permission dialog footer hints', () => {
test('bash permission footer says "reject" instead of "cancel"', () => {
const footer = 'Esc to reject'
expect(footer).toContain('reject')
expect(footer).not.toContain('cancel')
})
test('bash permission footer tab hint says "add feedback"', () => {
const tabHint = 'Tab to add feedback'
expect(tabHint).toContain('feedback')
expect(tabHint).not.toContain('amend')
})
test('file permission footer matches bash footer language', () => {
const bashFooter = 'Esc to reject'
const fileFooter = 'Esc to reject'
expect(bashFooter).toBe(fileFooter)
})
})
describe('Permission option labels', () => {
test('.claude/ folder option is under 60 chars', () => {
const label = 'Yes, allow edits to .claude/ config for this session'
expect(label.length).toBeLessThan(60)
expect(label).toContain('.claude/')
})
test('accept-once option has simple label', () => {
const label = 'Yes'
expect(label).toBe('Yes')
})
test('reject option has simple label', () => {
const label = 'No'
expect(label).toBe('No')
})
})
describe('Help General page getting started guide', () => {
test('step 1 mentions exploring code', () => {
const step1 =
'Ask a question or describe a task — Claude will explore your code and respond.'
expect(step1).toContain('explore')
expect(step1).toContain('question')
})
test('step 2 mentions reviewing actions', () => {
const step2 =
'When Claude wants to edit files or run commands, you review and approve each action.'
expect(step2).toContain('review')
expect(step2).toContain('approve')
})
test('step 3 mentions key commands', () => {
const step3 = '/commit'
const step3b = '/help'
const step3c = '?'
expect(step3).toBe('/commit')
expect(step3b).toBe('/help')
expect(step3c).toBe('?')
})
test('heading says "Getting started"', () => {
const heading = 'Getting started'
expect(heading).toBe('Getting started')
})
})