本文整理汇总了TypeScript中@ephox/mcagar.UiChains.cFillActiveDialog方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UiChains.cFillActiveDialog方法的具体用法?TypeScript UiChains.cFillActiveDialog怎么用?TypeScript UiChains.cFillActiveDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/mcagar.UiChains
的用法示例。
在下文中一共展示了UiChains.cFillActiveDialog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
UnitTest.asynctest('browser.tinymce.plugins.image.FigureResizeTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
ModernTheme();
ImagePlugin();
const cGetBody = Chain.mapper(function (editor) {
return TinyDom.fromDom(editor.getBody());
});
const cGetElementSize = Chain.mapper(function (elm) {
const elmStyle = elm.dom().style;
return { w: elmStyle.width, h: elmStyle.height };
});
const cDragHandleRight = function (px) {
return Chain.op(function (input) {
const dom = input.editor.dom;
const target = input.resizeSE.dom();
const pos = dom.getPos(target);
dom.fire(target, 'mousedown', { screenX: pos.x, screenY: pos.y });
dom.fire(target, 'mousemove', { screenX: pos.x + px, screenY: pos.y });
dom.fire(target, 'mouseup');
});
};
Pipeline.async({}, [
Chain.asStep({}, [
Editor.cFromSettings({
plugins: 'image',
toolbar: 'image',
indent: false,
image_caption: true,
height: 400,
skin_url: '/project/js/tinymce/skins/lightgray'
}),
UiChains.cClickOnToolbar('click image button', 'div[aria-label="Insert/edit image"]'),
UiChains.cFillActiveDialog({
src: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
width: 100,
height: 100,
caption: true
}),
UiChains.cSubmitDialog(),
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cGetBody, 'editorBody'),
// click the image, but expect the handles on the figure
NamedChain.direct('editorBody', UiFinder.cFindIn('figure > img'), 'img'),
NamedChain.direct('img', Mouse.cTrueClick, '_'),
NamedChain.direct(NamedChain.inputName(), ApiChains.cAssertSelection([], 0, [], 1), '_'),
NamedChain.direct('editorBody', Chain.control(
UiFinder.cFindIn('#mceResizeHandlese'),
Guard.tryUntil('wait for resize handlers', 100, 40000)
), '_'),
// actually drag the handle to the right
NamedChain.direct('editorBody', UiFinder.cFindIn('#mceResizeHandlese'), 'resizeSE'),
NamedChain.write('_', cDragHandleRight(100)),
NamedChain.direct('img', cGetElementSize, 'imgSize'),
NamedChain.direct('imgSize', Assertions.cAssertEq('asserting image size after resize', { w: '200px', h: '200px' }), '_'),
NamedChain.output('editor')
]),
Editor.cRemove
])
], function () {
success();
}, failure);
});