mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 08:34:54 -04:00
Added markdown-file import (#645)
* Added markdown-file import * Reset file input after read, don't add unnecessary blank lines * Add cypress-file-upload dependency * Add cypress tests for md file importing * Added CHANGELOG entry
This commit is contained in:
parent
c1d4ac1014
commit
729ad652b3
11 changed files with 113 additions and 7 deletions
42
cypress/integration/import.spec.ts
Normal file
42
cypress/integration/import.spec.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
describe('Import markdown file', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/n/test')
|
||||
cy.get('.btn.active.btn-outline-secondary > i.fa-columns')
|
||||
.should('exist')
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('{ctrl}a', { force: true })
|
||||
.type('{backspace}')
|
||||
})
|
||||
|
||||
it('import on blank note', () => {
|
||||
cy.get('button#editor-menu-import')
|
||||
.click()
|
||||
cy.get('.import-md-file')
|
||||
.click()
|
||||
cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]')
|
||||
.attachFile('import.md')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
||||
.should('have.text', '# Some short import test file')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
|
||||
.should('have.text', ':)')
|
||||
})
|
||||
|
||||
it('import on note with content', () => {
|
||||
cy.get('.CodeMirror textarea')
|
||||
.type('test\nabc', { force: true })
|
||||
cy.get('button#editor-menu-import')
|
||||
.click()
|
||||
cy.get('.import-md-file')
|
||||
.click()
|
||||
cy.get('div[aria-labelledby="editor-menu-import"] > input[type=file]')
|
||||
.attachFile('import.md')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(1) > .CodeMirror-line > span > span')
|
||||
.should('have.text', 'test')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(2) > .CodeMirror-line > span > span')
|
||||
.should('have.text', 'abc')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(3) > .CodeMirror-line > span > span')
|
||||
.should('have.text', '# Some short import test file')
|
||||
cy.get('.CodeMirror-code > div:nth-of-type(4) > .CodeMirror-line > span > span')
|
||||
.should('have.text', ':)')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue