Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test for 0 byte file
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jun 9, 2022
commit ea508eda85561b673de75abdddb60f3b2a859aad
25 changes: 25 additions & 0 deletions cypress/integration/viewer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Open test.md in viewer', function() {

// Upload test files
cy.uploadFile('test.md', 'text/markdown')
cy.uploadFile('empty.md', 'text/markdown')
})

beforeEach(function() {
Expand Down Expand Up @@ -68,6 +69,30 @@ describe('Open test.md in viewer', function() {
cy.screenshot()
})

it('Open an empty file', function() {
cy.openFile('empty.md')

cy.log('Inspect viewer')
const viewer = cy.get('#viewer')
viewer.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
viewer.get('.modal-title').should('contain', 'empty.md')
viewer.get('.modal-header button.action-item__menutoggle')
.should('be.visible')

cy.log('Inspect editor')
const editor = viewer.get('#editor .ProseMirror')
editor.should('contain', '')

cy.log('Inspect menubar')
const menubar = editor.get('.menubar .menubar-icons')
menubar.get('.icon-undo').should('be.visible')
menubar.get('.icon-bold').should('be.visible')

cy.screenshot()
})

it('Closes the editor', function() {
cy.openFile('test.md')
cy.get('#viewer .modal-header button.header-close').click()
Expand Down