ajout d'image
This commit is contained in:
@@ -470,6 +470,37 @@ describe('IssueDetail — existing issue', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('onDescriptionPaste', () => {
|
||||
afterEach(() => vi.unstubAllGlobals());
|
||||
|
||||
it('inserts image markdown into issue.description', async () => {
|
||||
vi.stubGlobal('FileReader', class {
|
||||
readonly result = 'data:image/png;base64,xyz';
|
||||
onload: ((e: any) => void) | null = null;
|
||||
readAsDataURL(_file: File) {
|
||||
Promise.resolve().then(() => this.onload?.({ target: { result: this.result } }));
|
||||
}
|
||||
});
|
||||
|
||||
(component as any).issue.description = 'existing';
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = 'existing';
|
||||
ta.selectionStart = 0;
|
||||
ta.selectionEnd = 0;
|
||||
const file = new File([''], 'img.png', { type: 'image/png' });
|
||||
const event = {
|
||||
clipboardData: { items: [{ type: 'image/png', getAsFile: () => file }] },
|
||||
preventDefault: vi.fn(),
|
||||
target: ta,
|
||||
} as unknown as ClipboardEvent;
|
||||
|
||||
(component as any).onDescriptionPaste(event);
|
||||
await Promise.resolve();
|
||||
|
||||
expect((component as any).issue.description).toContain('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('descriptionHtml', () => {
|
||||
it('returns a truthy SafeHtml for markdown input', () => {
|
||||
(component as any).issue.description = '# Title\n**bold**';
|
||||
|
||||
Reference in New Issue
Block a user