[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
05122024
/
htdocs
/
pmb2
/
assets
/
tinymce
/
src
/
core
/
src
/
test
/
js
/
browser
/
dom
/
[
Home
]
File: PaddingBrTest.js
asynctest( 'browser.tinymce.core.dom.PaddingBrTest', [ 'ephox.agar.api.Assertions', 'ephox.agar.api.GeneralSteps', 'ephox.agar.api.Logger', 'ephox.agar.api.Pipeline', 'ephox.agar.api.Step', 'ephox.sugar.api.node.Element', 'ephox.sugar.api.properties.Html', 'tinymce.core.dom.Empty', 'tinymce.core.dom.PaddingBr' ], function (Assertions, GeneralSteps, Logger, Pipeline, Step, Element, Html, Empty, PaddingBr) { var success = arguments[arguments.length - 2]; var failure = arguments[arguments.length - 1]; var sTestRemoveTrailingBr = function (label, inputHtml, expectedHtml) { return Step.sync(function () { var elm = Element.fromHtml(inputHtml); PaddingBr.removeTrailingBr(elm); Assertions.assertHtml(label, expectedHtml, Html.getOuter(elm)); }); }; var sTestTrimBlockTrailingBr = function (label, inputHtml, expectedHtml) { return Step.sync(function () { var elm = Element.fromHtml(inputHtml); PaddingBr.trimBlockTrailingBr(elm); Assertions.assertHtml(label, expectedHtml, Html.getOuter(elm)); }); }; Pipeline.async({}, [ Logger.t('removeTrailingBrs', GeneralSteps.sequence([ sTestRemoveTrailingBr('Should be untouched since it has no brs', '<p>a</p>', '<p>a</p>'), sTestRemoveTrailingBr('Should be untouched since the br not at the edge of the tree', '<p>a<br>b</p>', '<p>a<br>b</p>'), sTestRemoveTrailingBr('Should be untouched since the br not at the edge of the tree', '<p><b>a<br></b>b</p>', '<p><b>a<br></b>b</p>'), sTestRemoveTrailingBr('Should remove trailing br 1', '<p>a<br></p>', '<p>a</p>'), sTestRemoveTrailingBr('Should remove trailing br 2', '<p><b>a<br></b></p>', '<p><b>a</b></p>'), sTestRemoveTrailingBr('Should remove trailing br 3', '<p><i><b>a<br></b></i></p>', '<p><i><b>a</b></i></p>'), sTestRemoveTrailingBr('Should remove trailing br 4', '<p><b>a</b><br></p>', '<p><b>a</b></p>'), sTestRemoveTrailingBr('Should be untouched since there is more than one br', '<p>a<br><br></p>', '<p>a<br><br></p>'), sTestRemoveTrailingBr('Should be untouched since there is more than one br', '<p><b>a<br></b><br></p>', '<p><b>a<br></b><br></p>') ])), Logger.t('fillWithPaddingBr', GeneralSteps.sequence([ Step.sync(function () { var elm = Element.fromHtml('<p>a</p>'); PaddingBr.fillWithPaddingBr(elm); Assertions.assertHtml('Should be padded with bogus br', '<p><br data-mce-bogus="1"></p>', Html.getOuter(elm)); }) ])), Logger.t('isPaddedElement', Step.sync(function () { Assertions.assertEq('Should not be padded', false, PaddingBr.isPaddedElement(Element.fromHtml('<p>a</p>'))); Assertions.assertEq('Should not be padded', false, PaddingBr.isPaddedElement(Element.fromHtml('<p>\u00a0\u00a0</p>'))); Assertions.assertEq('Should not be padded', false, PaddingBr.isPaddedElement(Element.fromHtml('<p><br><br></p>'))); Assertions.assertEq('Should not be padded', false, PaddingBr.isPaddedElement(Element.fromHtml('<p></p>'))); Assertions.assertEq('Should be padded nbsp', true, PaddingBr.isPaddedElement(Element.fromHtml('<p>\u00a0</p>'))); Assertions.assertEq('Should be padded br', true, PaddingBr.isPaddedElement(Element.fromHtml('<p><br></p>'))); })), Logger.t('trimPaddingBrs', GeneralSteps.sequence([ sTestTrimBlockTrailingBr('Should be untouched since it has no brs', '<div></div>', '<div></div>'), sTestTrimBlockTrailingBr('Should be untouched since it has no brs', '<div><p>a</p></div>', '<div><p>a</p></div>'), sTestTrimBlockTrailingBr('Should be without br since it is after a block', '<div><p>a</p><br></div>', '<div><p>a</p></div>'), sTestTrimBlockTrailingBr('Should be untouched since it is multiple brs', '<div><p>a</p><br><br></div>', '<div><p>a</p><br><br></div>'), sTestTrimBlockTrailingBr('Should be untouched since it is br after a inline', '<div><b>a</b><br></div>', '<div><b>a</b><br></div>'), sTestTrimBlockTrailingBr('Should be untouched since it is br after inlide inline', '<span><b>a</b><br></span>', '<span><b>a</b><br></span>') ])) ], function () { success(); }, failure); } );