striven-editor

Maintained and contributed to an open source WYSIWYG editor as an internship project that made it to production and was adopted by the company I was working at.
git clone https://unitehenry.com/git/striven-editor.git
Log | Files | Refs | README | LICENSE

commit a0b043b12afa362b477c9e994dc5e1bfee340ff5
parent 459d69dd6c2f6206431c1ffdf981f5b75752c215
Author: Henry Unite <unitehenry@gmail.com>
Date:   Fri, 11 Sep 2020 16:58:20 -0400

regression test for overflow

Diffstat:
Mdemo/src/test.js | 44++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/demo/src/test.js b/demo/src/test.js @@ -87,7 +87,7 @@ describe('Regression Tests', () => { }); - it('apply font format to content', (done) => { + it('should apply font format to content', (done) => { const se = getEditor(); se.setContent('<p>Change me to an H1 format</p>'); @@ -106,10 +106,50 @@ describe('Regression Tests', () => { }); + it('should apply a scroll bar for large content', () => { + const se = getEditor(); + se.editor.setAttribute('max-height', '300px'); + se.body.style.maxHeight = '300px'; + + let largeContent = ''; + for(let i = 0; i < 1000; i++) { + largeContent += `<p>line ${i}</p>`; + } + + se.setContent(largeContent); + se.body.blur(); + + assert.notEqual(se.body.scrollHeight, se.body.offsetHeight, 'scroll bar was set'); + se.clearContent(); + se.overflow(); + + }); + + it('should apply a scroll bar for large content after collapsing fullscreen', () => { + const se = getEditor(); + se.editor.setAttribute('max-height', '300px'); + se.body.style.maxHeight = '300px'; + + se.toolbar.querySelector('#toolbar-fullscreen').click(); + + let largeContent = ''; + for(let i = 0; i < 1000; i++) { + largeContent += `<p>line ${i}</p>`; + } + + se.setContent(largeContent); + se.toolbar.querySelector('#toolbar-fullscreen').click(); + + assert.notEqual(se.body.scrollHeight, se.body.offsetHeight, 'scroll bar was set'); + se.clearContent(); + se.overflow(); + + }); + }); /* Internal Tests */ -describe('Editor Initilization', () => { +describe('Internal Tests', () => { it('should of been created', () => { assert.exists(getEditor().editor, 'Editor is created'); });