收口个人中心昵称输入组件

迁移昵称弹窗输入框到 PlatformTextField 暗色表单

保留新昵称 label 语义和 Enter 提交行为

补充昵称弹窗公共输入断言

更新 PlatformUiKit 文档和 Hermes 决策记录
This commit is contained in:
2026-06-10 12:13:54 +08:00
parent 0f5e0114a9
commit c1905d52ac
4 changed files with 44 additions and 2 deletions

View File

@@ -3075,6 +3075,39 @@ test('desktop account entry uses saved avatar image when available', async () =>
await screen.findByText('1 / 1');
});
test('profile nickname modal uses platform text field and submits with Enter', async () => {
const user = userEvent.setup();
mockUpdateAuthProfile.mockResolvedValueOnce({
id: 'user-1',
publicUserCode: '100001',
displayName: '新昵称',
avatarUrl: null,
phoneNumberMasked: null,
loginMethod: 'password',
bindingStatus: 'active',
wechatBound: false,
});
renderProfileView();
await user.click(screen.getByLabelText('修改昵称'));
const nicknameInput = (await screen.findByLabelText(
'新昵称',
)) as HTMLInputElement;
expect(nicknameInput.value).toBe('测试玩家');
expect(nicknameInput.className).toContain('platform-text-field');
expect(nicknameInput.className).toContain('platform-text-field--editor-dark');
await user.clear(nicknameInput);
await user.type(nicknameInput, '新昵称{Enter}');
await waitFor(() => {
expect(mockUpdateAuthProfile).toHaveBeenCalledWith({
displayName: '新昵称',
});
});
});
test('profile avatar upload uses the shared square crop tool', async () => {
stubFileReader('data:image/png;base64,avatar-source');
stubImage(800, 600);