|
| 1 | +/// <reference types="cypress" /> |
| 2 | + |
| 3 | +describe('Default statusbar', () => { |
| 4 | + beforeEach(() => { |
| 5 | + cy.visit(__dirname + '/default.html'); |
| 6 | + }); |
| 7 | + |
| 8 | + it('loads the editor with default statusbar', () => { |
| 9 | + cy.get('.EasyMDEContainer').should('be.visible'); |
| 10 | + cy.get('.EasyMDEContainer .editor-statusbar').should('be.visible'); |
| 11 | + |
| 12 | + cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty'); |
| 13 | + |
| 14 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').before('content').should('contain', 'lines: '); |
| 15 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1'); |
| 16 | + |
| 17 | + cy.get('.EasyMDEContainer .editor-statusbar .words').before('content').should('contain', 'words: '); |
| 18 | + cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '0'); |
| 19 | + |
| 20 | + cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:1'); |
| 21 | + }); |
| 22 | + |
| 23 | + it('updates the statusbar when typing', () => { |
| 24 | + cy.get('.EasyMDEContainer').should('be.visible'); |
| 25 | + cy.get('.EasyMDEContainer .editor-statusbar').should('be.visible'); |
| 26 | + |
| 27 | + cy.get('.EasyMDEContainer .CodeMirror').type('Hello'); |
| 28 | + |
| 29 | + cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty'); |
| 30 | + |
| 31 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1'); |
| 32 | + cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '1'); |
| 33 | + cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:6'); |
| 34 | + |
| 35 | + cy.get('.EasyMDEContainer .CodeMirror').type(' World'); |
| 36 | + |
| 37 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '1'); |
| 38 | + cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '2'); |
| 39 | + cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '1:12'); |
| 40 | + |
| 41 | + cy.get('.EasyMDEContainer .CodeMirror').type('{enter}'); |
| 42 | + |
| 43 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '2'); |
| 44 | + cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '2'); |
| 45 | + cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '2:1'); |
| 46 | + |
| 47 | + cy.get('.EasyMDEContainer .CodeMirror').type('This is a sample text.{enter}We\'re testing the statusbar.{enter}Did it work?'); |
| 48 | + |
| 49 | + cy.get('.EasyMDEContainer .editor-statusbar .autosave').should('be.empty'); |
| 50 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').before('content').should('contain', 'lines: '); |
| 51 | + cy.get('.EasyMDEContainer .editor-statusbar .lines').should('contain', '4'); |
| 52 | + cy.get('.EasyMDEContainer .editor-statusbar .words').before('content').should('contain', 'words: '); |
| 53 | + cy.get('.EasyMDEContainer .editor-statusbar .words').should('contain', '15'); |
| 54 | + cy.get('.EasyMDEContainer .editor-statusbar .cursor').should('contain', '4:13'); |
| 55 | + }); |
| 56 | +}); |
0 commit comments