本文整理汇总了TypeScript中@ephox/agar.Chain.fromChains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.fromChains方法的具体用法?TypeScript Chain.fromChains怎么用?TypeScript Chain.fromChains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Chain
的用法示例。
在下文中一共展示了Chain.fromChains方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('insert url by typing', GeneralSteps.sequence([
tinyUi.sClickOnToolbar('click on link button', 'button[aria-label="Insert/edit link"]'),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
[
Chain.fromChains([
cFindByLabelFor('URL'),
UiControls.cSetValue('http://www.test.com/'),
cFakeEvent('input')
]),
Chain.fromChains([
cFindByLabelFor('Text to display'),
UiControls.cGetValue,
Assertions.cAssertEq('should be the same url', 'http://www.test.com/')
]),
cCloseDialog
]
)
])
]))
], onSuccess, onFailure);
}, {
示例2: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Log.stepsAsStep('TBA', 'Media: test cached response', [
tinyUi.sClickOnToolbar('click media button', 'button[aria-label="Insert/edit media"]'),
Chain.asStep({}, [
Chain.fromParent(
tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
Chain.fromChains([
Utils.cSetSourceInput(tinyUi, 'test'),
Utils.cFakeEvent('paste'),
Chain.wait(0) // wait is needed because paste is triggered async
]),
Chain.runStepsOnValue(() => [ Utils.sAssertEmbedData(tinyUi, '<div>x</div>') ]),
Chain.fromChains([
Utils.cSetSourceInput(tinyUi, 'XXX')
]),
Chain.fromChains([
UiFinder.cFindIn(Utils.selectors.saveButton),
Mouse.cClick
])
]
)
]),
sWaitForAndAssertNotification('<p>Media embed handler threw unknown error.</p>'),
tinyApis.sAssertContent('')
])
], onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
tinyApis.sSetContent('<p>abc 123</p>'),
tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sExecCommand('mceanchor'),
Chain.asStep(Element.fromDom(document.body), [
Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[aria-label="Anchor"][role="dialog"]'),
[
Chain.fromChains([
UiFinder.cFindIn('input'),
UiControls.cSetValue('abc')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Ok")'),
Mouse.cClick
])
]
)
]),
tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')
], onSuccess, onFailure);
}, {
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({},
Log.steps('TBA', 'Anchor: Add anchor by selecting text content, then check that anchor is inserted correctly', [
tinyApis.sFocus,
tinyApis.sSetContent('<p>abc 123</p>'),
tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sExecCommand('mceanchor'),
Chain.asStep(Element.fromDom(document.body), [
Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[role="dialog"].tox-dialog'),
[
Chain.fromChains([
UiFinder.cFindIn('input'),
UiControls.cSetValue('abc')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Save")'),
Mouse.cClick
])
]
)
]),
tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')
])
, onSuccess, onFailure);
}, {
示例5: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Logger.t('test cached response', GeneralSteps.sequence([
tinyUi.sClickOnToolbar('click media button', 'div[aria-label="Insert/edit media"] > button'),
Chain.asStep({}, [
Chain.fromParent(
tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
Chain.fromChains([
Utils.cSetSourceInput(tinyUi, 'test'),
Utils.cFakeEvent('paste')
]),
Chain.fromChains([
cAssertEmbedValue('<div>x</div>')
]),
Chain.fromChains([
Utils.cSetSourceInput(tinyUi, 'XXX')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Ok")'),
Mouse.cClick
])
])
]),
sWaitForAndAssertNotification('Media embed handler threw unknown error.'),
tinyApis.sAssertContent('')
]))
], onSuccess, onFailure);
}, {
示例6: Plugin
UnitTest.asynctest('browser.tinymce.plugins.media.NoAdvancedTabTest', (success, failure) => {
Plugin();
Theme();
Pipeline.async({}, [
Log.chainsAsStep('TBA', 'Media: if alt source and poster set to false, do not show advance tab', [
Chain.fromParent(
Editor.cFromSettings({
plugins: ['media'],
toolbar: 'media',
media_alt_source: false,
media_poster: false,
theme: 'silver',
base_url: '/project/tinymce/js/tinymce'
}),
[
Chain.fromChains([
UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
Chain.inject(Body.body()),
UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
Utils.cNotExists('div.tox-tab:contains(Advanced)')
]),
Editor.cRemove
]
)
]),
Log.chainsAsStep('TBA', 'Media: if alt source and poster not set to false, show advance tab', [
Chain.fromParent(
Editor.cFromSettings({
plugins: ['media'],
toolbar: 'media',
theme: 'silver',
base_url: '/project/tinymce/js/tinymce'
}),
[
Chain.fromChains([
UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
Chain.inject(Body.body()),
UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
Utils.cExists('div.tox-tab:contains(Advanced)')
]),
Editor.cRemove
]
)
])
], () => success(), failure);
});
示例7: from
const cResizeToPos = (sx: number, sy: number, dx: number, dy: number, delta: number = 10) => {
// Simulate moving the mouse, by making a number of movements
const numMoves = sy === dy ? Math.abs(dx - sx) / delta : Math.abs(dy - sy) / delta;
// Determine the deltas based on the number of moves to make
const deltaX = (dx - sx) / numMoves;
const deltaY = (dy - sy) / numMoves;
// Move and release the mouse
return Chain.control(
Chain.fromChains([
UiFinder.cFindIn('.tox-blocker'),
Mouse.cMouseMoveTo(sx, sy)
].concat(
Arr.range(numMoves, (count) => {
const nx = sx + count * deltaX;
const ny = sy + count * deltaY;
return Mouse.cMouseMoveTo(nx, ny);
})
).concat([
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUp
])
),
Guard.addLogging(`Resizing from (${sx}, ${sy}) to (${dx}, ${dy})`)
);
};
示例8: function
const sDragDropBlocker = function (container, selector, dx, dy) {
return Chain.asStep({}, [
Chain.fromParent(Chain.inject(container), [
Chain.fromChains([
UiFinder.cFindIn(selector),
Mouse.cMouseDown
]),
Chain.fromChains([
UiFinder.cFindIn('div.ephox-dragster-blocker'),
Mouse.cMouseMove,
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUpTo(dx, dy)
])
])
]);
};
示例9:
const sDragDropBlocker = (container, selector, dx, dy) => {
return Logger.t('Block dragging and dropping of any other element in the container', Chain.asStep({}, [
Chain.fromParent(Chain.inject(container), [
Chain.fromChains([
UiFinder.cFindIn(selector),
Mouse.cMouseDown
]),
Chain.fromChains([
UiFinder.cFindIn('div.ephox-dragster-blocker'),
Mouse.cMouseMove,
Mouse.cMouseMoveTo(dx, dy),
Mouse.cMouseUpTo(dx, dy)
])
])
]));
};
示例10:
const cSetInputValue = (section, newValue) => Chain.control(
Chain.fromChains([
UiFinder.cFindIn(`label:contains(${section}) + div > input`),
UiControls.cSetValue(newValue)
]),
Guard.addLogging('Set input value' + newValue)
);