修复图片画布素材上传鉴权
统一侧栏上传入口走上传工作流 未登录素材上传先弹账号入口,不再打开文件选择器 补充上传鉴权回归测试和编辑器拆分文档记录
This commit is contained in:
@@ -141,6 +141,9 @@ function UploadWorkflowHarness({
|
||||
>
|
||||
上传素材
|
||||
</button>
|
||||
<button type="button" onClick={() => workflow.requestUpload('asset')}>
|
||||
请求素材上传
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
@@ -171,6 +174,12 @@ function UploadWorkflowHarness({
|
||||
>
|
||||
选择角色规范
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => workflow.requestUpload('character-spec')}
|
||||
>
|
||||
请求角色规范上传
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -227,6 +236,40 @@ describe('useImageCanvasUploadWorkflow', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('opens login instead of the asset file picker when protected data is unavailable', () => {
|
||||
const openEditorLoginModal = vi.fn();
|
||||
render(
|
||||
<UploadWorkflowHarness
|
||||
canAccessProtectedData={false}
|
||||
openEditorLoginModal={openEditorLoginModal}
|
||||
/>,
|
||||
);
|
||||
const uploadInput = screen.getByLabelText('上传图片文件') as HTMLInputElement;
|
||||
const clickUploadInput = vi.spyOn(uploadInput, 'click');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '请求素材上传' }));
|
||||
|
||||
expect(openEditorLoginModal).toHaveBeenCalledTimes(1);
|
||||
expect(clickUploadInput).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps generation reference uploads local and opens the file picker without login', () => {
|
||||
const openEditorLoginModal = vi.fn();
|
||||
render(
|
||||
<UploadWorkflowHarness
|
||||
canAccessProtectedData={false}
|
||||
openEditorLoginModal={openEditorLoginModal}
|
||||
/>,
|
||||
);
|
||||
const uploadInput = screen.getByLabelText('上传图片文件') as HTMLInputElement;
|
||||
const clickUploadInput = vi.spyOn(uploadInput, 'click');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '请求角色规范上传' }));
|
||||
|
||||
expect(openEditorLoginModal).not.toHaveBeenCalled();
|
||||
expect(clickUploadInput).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('creates an uploading asset card, adds a canvas layer, and patches the layer with the persisted asset id', async () => {
|
||||
const deferredAsset = createDeferred<{
|
||||
assetId: string;
|
||||
|
||||
Reference in New Issue
Block a user