Skip to content
Merged
Show file tree
Hide file tree
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 c88712d0d6f1f07e20c9a604ae5185d5a596628b
Empty file added cypress/fixtures/empty.md
Empty file.
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