本文整理匯總了TypeScript中@ephox/mcagar.UiChains.cSubmitDialog方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript UiChains.cSubmitDialog方法的具體用法?TypeScript UiChains.cSubmitDialog怎麽用?TypeScript UiChains.cSubmitDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/mcagar.UiChains
的用法示例。
在下文中一共展示了UiChains.cSubmitDialog方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
});
示例2: SilverTheme
UnitTest.asynctest('browser.tinymce.plugins.image.FigureResizeTest', (success, failure) => {
SilverTheme();
ImagePlugin();
const cGetBody = Chain.control(
Chain.mapper(function (editor: any) {
return TinyDom.fromDom(editor.getBody());
}),
Guard.addLogging('Get body')
);
const cGetElementSize = Chain.control(
Chain.mapper(function (elm: any) {
const elmStyle = elm.dom().style;
return { w: elmStyle.width, h: elmStyle.height };
}),
Guard.addLogging('Get element size')
);
const cDragHandleRight = function (px) {
return Chain.control(
Chain.op(function (input: any) {
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');
}),
Guard.addLogging('Drag handle right')
);
};
Pipeline.async({}, [
Log.chainsAsStep('TBA', 'Image: resizing image in figure', [
McEditor.cFromSettings({
theme: 'silver',
plugins: 'image',
toolbar: 'image',
indent: false,
image_caption: true,
height: 400,
base_url: '/project/tinymce/js/tinymce'
}),
UiChains.cClickOnToolbar('click image button', 'button[aria-label="Insert/edit image"]'),
Chain.control(
cFillActiveDialog({
src: {
value: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
},
dimensions: {
width: '100px',
height: '100px',
},
caption: true
}),
Guard.tryUntil('Waiting for fill active dialog', 100, 5000)
),
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')
]),
McEditor.cRemove
])
], function () {
success();
}, failure);
});