本文整理汇总了TypeScript中@ephox/agar.Chain.op方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.op方法的具体用法?TypeScript Chain.op怎么用?TypeScript Chain.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Chain
的用法示例。
在下文中一共展示了Chain.op方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sAssertButtonIconImage = function (tooltip, expectedIconUrl) {
return Chain.asStep({}, [
cWaitForToolbar,
cFindButton(tooltip),
UiFinder.cFindIn('i'),
Chain.op(function (iconElm) {
const actualUrl = normalizeUrlString(iconElm.dom().style.backgroundImage);
Assertions.assertEq('Needs to have correct icon url', 'url(' + expectedIconUrl + ')', actualUrl);
})
]);
};
示例2: function
const cDragHandleRight = function (px) {
return 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');
});
};
示例3:
const sContentContains = (tinyApis: any, ed: Editor, pattern: string, isContained: boolean) => {
return Chain.asStep({ }, [
Chain.mapper(() => ed.getContent()),
Chain.op((content) => {
Assertions.assertEq(
'editor.getContent() should contain: ' + pattern + ' = ' + isContained,
true,
content.indexOf(pattern) > -1 === isContained
);
})
]);
};
示例4: cGetImageSources
const sAssertImageFlip = (label) => {
return Chain.asStep({editor}, [
Chain.label(`Assert ${label}`,
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cGetImageSources(label), 'urls'),
NamedChain.read('urls', Chain.op((urls) => {
Assertions.assertEq(`Image should be flipped: ${label}`, true, ( urls.srcBeforeFlip !== urls.srcAfterFlip ));
}))
]))
]);
};
示例5: function
const assertStructureInDialog = function (errString, objStruc, waitOn, clickOn) {
return Logger.t('Assert structure in dialog', Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Could not find notification', waitOn),
Mouse.cClickOn(clickOn),
Chain.control(
Chain.op((panel) => {
Assertions.assertPresence(errString, objStruc, panel);
}),
Guard.tryUntil('Keep waiting', 100, 4000)
)
]));
};
示例6:
const sAssertChanges = (message: string, expected: Array<{uid: string, state: boolean, name: string}>) => Logger.t(
message,
// Use a chain so that changes.get() can be evaluated at run-time.
Chain.asStep({ }, [
Chain.mapper((_) => {
return changes.get();
}),
Chain.op((cs: Array<{uid: string, name: string}>) => {
Assertions.assertEq('Checking changes', expected, cs);
})
])
);
示例7: function
const cSetSelection = function (startPath, startOffset, endPath, endOffset) {
return Chain.op(function (editor) {
const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
const rng = editor.dom.createRng();
rng.setStart(startContainer.dom(), startOffset);
rng.setEnd(endContainer.dom(), endOffset);
editor.selection.setRng(rng);
});
};
示例8: function
const cAssertBlockBoundaryPositions = function (fromPath, fromOffset, toPath, toOffset) {
return Chain.op(function (blockBoundaryOption) {
const fromContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), fromPath).getOrDie();
const toContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), toPath).getOrDie();
const blockBoundary = blockBoundaryOption.getOrDie();
Assertions.assertDomEq('Should be expected from container', fromContainer, Element.fromDom(blockBoundary.from().position().container()));
Assertions.assertEq('Should be expected from offset', fromOffset, blockBoundary.from().position().offset());
Assertions.assertDomEq('Should be expected to container', toContainer, Element.fromDom(blockBoundary.to().position().container()));
Assertions.assertEq('Should be expected to offset', toOffset, blockBoundary.to().position().offset());
});
};