import { Assertions, GeneralSteps, Logger, Pipeline, Step } from '@ephox/agar'; import { Element } from '@ephox/sugar'; import Empty from 'tinymce/core/dom/Empty'; import { UnitTest } from '@ephox/bedrock'; UnitTest.asynctest('browser.tinymce.core.dom.EmptyTest', function () { const success = arguments[arguments.length - 2]; const failure = arguments[arguments.length - 1]; const sTestEmpty = function (html, expected) { return Step.sync(function () { const elm = Element.fromHtml(html); const expectedLabel = expected ? 'empty' : 'not empty'; Assertions.assertEq(html + ' should be treated as ' + expectedLabel, expected, Empty.isEmpty(elm)); }); }; Pipeline.async({}, [ Logger.t('Empty elements', GeneralSteps.sequence([ sTestEmpty(' ', true), sTestEmpty('\t', true), sTestEmpty('\r', true), sTestEmpty('\n', true), sTestEmpty(' \t\r\n ', true), sTestEmpty('', true), sTestEmpty('
', true), sTestEmpty('', true), sTestEmpty('', true), sTestEmpty('
', true), sTestEmpty('', true), sTestEmpty('
abc
', false), sTestEmpty('