本文整理匯總了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());
});
};