commit 8fd3ad3cf9ea5e971ab46352247141dc89d3f0bd
parent 29758dbbdf0ba7e1cc56b85e3ada87582421d414
Author: unitehenry <unitehenry@gmail.com>
Date: Wed, 23 Sep 2020 15:41:31 -0400
Merge branch 'dev' of https://github.com/striven-erp/striven-editor into dev
Diffstat:
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/demo/src/test.js b/demo/src/test.js
@@ -50,7 +50,7 @@ describe('Regression Tests', () => {
});
- it('apply font style to content', (done) => {
+ it('should apply font style to content', (done) => {
const se = getEditor();
se.setContent('<p>Change me to Verdana</p>');
@@ -68,7 +68,7 @@ describe('Regression Tests', () => {
});
- it('apply font size to content', (done) => {
+ it('should apply font size to content', (done) => {
const se = getEditor();
se.setContent('<p>Change me to 36pt size</p>');
@@ -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');
});
diff --git a/package.json b/package.json
@@ -1,7 +1,7 @@
{
"name": "@striven-erp/striven-editor",
"private": false,
- "version": "3.7.3",
+ "version": "3.7.5",
"description": "The editor used for the Striven ERP system.",
"main": "./dist",
"scripts": {
diff --git a/src/striveneditor.js b/src/striveneditor.js
@@ -1709,6 +1709,8 @@ export default class StrivenEditor {
* @param {Number} size Size of the file in bytes
*/
createFileElement(name, size) {
+ const se = this;
+
const fileEl = document.createElement('div');
const fileNameEl = document.createElement('p');
const fileSizeEl = document.createElement('p');