Merge d8e8fdbb73
into f039bae67f
commit
b22a19f09d
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Default</title>
|
||||
<link rel="stylesheet" href="../../../dist/easymde.min.css">
|
||||
<script src="../../../dist/easymde.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<textarea id="textarea"></textarea>
|
||||
<script>
|
||||
const easyMDE = new EasyMDE({
|
||||
uploadImage: true,
|
||||
showIcons: ["upload-image"],
|
||||
imageUploadFunction: (file, onSuccess) => {
|
||||
onSuccess('https://test.com/test.jpg')
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,20 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe('Upload', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(__dirname + '/index.html');
|
||||
});
|
||||
|
||||
it('upload an image should insert a mock image url', () => {
|
||||
cy.get('.EasyMDEContainer button.upload-image').click();
|
||||
cy.get('.EasyMDEContainer input[type=file]').selectFile({
|
||||
contents: Cypress.Buffer.from('', 'utf-8'),
|
||||
fileName: 'test.jpg',
|
||||
mimeType: 'image/jpeg'
|
||||
}, {
|
||||
action: 'drag-drop',
|
||||
force: true
|
||||
});
|
||||
cy.get('.EasyMDEContainer .CodeMirror').contains('![test.jpg](https://test.com/test.jpg)');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue