-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the wrong text is inserted after uploading an image
- Loading branch information
Showing
3 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
Check failure on line 13 in cypress/e2e/4-image-upload/upload.cy.js GitHub Actions / test (14)
Check failure on line 13 in cypress/e2e/4-image-upload/upload.cy.js GitHub Actions / test (16)
|
||
}, { | ||
action: 'drag-drop', | ||
force: true | ||
Check failure on line 16 in cypress/e2e/4-image-upload/upload.cy.js GitHub Actions / test (14)
Check failure on line 16 in cypress/e2e/4-image-upload/upload.cy.js GitHub Actions / test (16)
|
||
}); | ||
cy.get('.EasyMDEContainer .CodeMirror').contains('![test.jpg](https://test.com/test.jpg)'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters