import { Assertions, GeneralSteps, Logger, Pipeline, RawAssertions, Step, Waiter } from '@ephox/agar'; import { Arr } from '@ephox/katamari'; import { TinyApis, TinyLoader } from '@ephox/mcagar'; import AutoresizePlugin from 'tinymce/plugins/autoresize/Plugin'; import FullscreenPlugin from 'tinymce/plugins/fullscreen/Plugin'; import ModernTheme from 'tinymce/themes/modern/Theme'; import { UnitTest } from '@ephox/bedrock'; UnitTest.asynctest('browser.tinymce.plugins.autoresize.AutoresizePluginTest', function () { const success = arguments[arguments.length - 2]; const failure = arguments[arguments.length - 1]; AutoresizePlugin(); FullscreenPlugin(); ModernTheme(); const sAssertEditorHeightAbove = function (editor, minHeight) { return Step.sync(function () { const editorHeight = editor.getContainer().clientHeight; RawAssertions.assertEq('should be above: ' + editorHeight + '>=' + minHeight, true, editorHeight >= minHeight); }); }; const sAssertEditorHeightBelow = function (editor, minHeight) { return Step.sync(function () { const editorHeight = editor.getContainer().clientHeight; RawAssertions.assertEq('should be below: ' + editorHeight + '<=' + minHeight, true, editorHeight <= minHeight); }); }; const sAssertScroll = function (editor, state) { return Step.sync(function () { const body = editor.getBody(); Assertions.assertEq('', !state, body.style.overflowY === 'hidden'); }); }; TinyLoader.setup(function (editor, onSuccess, onFailure) { const tinyApis = TinyApis(editor); Pipeline.async({}, Arr.flatten([ [ Logger.t('Fullscreen toggle scroll state', GeneralSteps.sequence([ tinyApis.sExecCommand('mceFullScreen'), sAssertScroll(editor, true), tinyApis.sExecCommand('mceFullScreen'), sAssertScroll(editor, false) ])), Logger.t('Editor size increase based on content size', GeneralSteps.sequence([ tinyApis.sSetContent('