import { describe, it } from '@ephox/bedrock-client'; import { SugarElement } from '@ephox/sugar'; import { assert } from 'chai'; import * as Empty from 'tinymce/core/dom/Empty'; describe('browser.tinymce.core.dom.EmptyTest', () => { const testEmpty = (html: string, expected: boolean) => { const elm = SugarElement.fromHtml(html); const expectedLabel = expected ? 'empty' : 'not empty'; assert.equal(Empty.isEmpty(elm), expected, html + ' should be treated as ' + expectedLabel); }; it('Empty elements', () => { testEmpty(' ', true); testEmpty('\t', true); testEmpty('\r', true); testEmpty('\n', true); testEmpty(' \t\r\n ', true); testEmpty('', true); testEmpty('

', true); testEmpty('', true); testEmpty('

', true); testEmpty('


', true); testEmpty('

', true); testEmpty('', true); testEmpty('

', true); testEmpty('



', true); testEmpty('', true); }); it('Non empty elements', () => { testEmpty('
', false); testEmpty('', false); testEmpty('', false); testEmpty('', false); testEmpty('
', false); testEmpty('a', false); testEmpty('abc', false); testEmpty('

abc

', false); testEmpty('



', false); testEmpty('

', false); testEmpty('', false); testEmpty('', false); testEmpty('', false); }); });