commit b9a7548f96dcc0dfd2f6c0a08d33745873a066a1 parent 78c0098532886297da6c2a915630b6506396a741 Author: Henry Unite <unitehenry@gmail.com> Date: Mon, 14 Sep 2020 15:58:14 -0400 attach file test Diffstat:
| M | demo/src/test.js | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/demo/src/test.js b/demo/src/test.js @@ -146,6 +146,25 @@ describe('Regression Tests', () => { }); + it('should attach a file', (done) => { + + const se = getEditor(); + + fetch('https://raw.githubusercontent.com/striven-erp/striven-editor/master/LICENSE.txt') + .then(res => res.body.getReader().read().then(d => { + se.attachFile(new File([new Blob(d.value)], 'LICENSE.txt')); + + const isAttached = se.getFiles().pop() instanceof File; + const elCreated = se.filesSection.querySelector('.se-file .se-file-name').textContent === 'LICENSE.txt'; + + assert.isTrue(isAttached && elCreated, 'file was attached'); + se.clearFiles(); + done(); + + })); + + }); + }); /* Internal Tests */