本文整理汇总了TypeScript中@ephox/agar.Chain.label方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.label方法的具体用法?TypeScript Chain.label怎么用?TypeScript Chain.label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Chain
的用法示例。
在下文中一共展示了Chain.label方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sAssertErrorMessage = function (html) {
return Step.label('Check notification message', Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Find notification', '.tox-notification__body > p'),
Chain.label('Get notification HTML', Chain.mapper(Html.get)),
Chain.label('Assert HTML matches expected', Assertions.cAssertHtml('Message html does not match', html))
]));
};
示例2: function
const sTestIsXYInContentArea = function (editor, deltaX, deltaY) {
const dx1 = - 25 - deltaX;
const dy1 = -25 - deltaY;
const dx2 = - 5 - deltaX;
const dy2 = - 5 - deltaY;
return Step.label('Check points relative to deltaX=' + deltaX + ' deltaY=' + deltaY, Chain.asStep({}, [
Chain.fromParent(
Chain.label(
'Calculate bounding rectangle',
Chain.injectThunked(() => getIframeClientRect(editor))
), [
Chain.label(
'Check 〈bottom right〉 + (' + dx1 + ', ' + dy1 + ') is inside editor',
Chain.op((rect) => Assertions.assertEq(
'Should be inside the area since the scrollbars are excluded',
true,
EditorView.isXYInContentArea(editor, rect.width + dx1, rect.height + dy1)
))
),
Chain.label(
'Check 〈bottom right〉 + (' + dx2 + ', ' + dy2 + ') is ' + (hiddenScrollbar ? 'inside' : 'outside') + ' editor',
Chain.op((rect) => Assertions.assertEq(
(hiddenScrollbar ?
'Should be inside the area since the scrollbars are hidden' :
'Should be outside the area since the cordinate is on the scrollbars'),
hiddenScrollbar,
EditorView.isXYInContentArea(editor, rect.width + dx2, rect.height + dy2)
))
)
]
)
]));
};
示例3: cClickContextToolbarButton
const cGetImageSources = (label) => {
return NamedChain.asChain(
[
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
Chain.label('Store img src before flip', NamedChain.write('srcBeforeFlip', cGetImageSrc)),
Chain.label('Flip image', NamedChain.read('editor', cClickContextToolbarButton(label))),
// Wait for image to flip
Chain.wait(500),
Chain.label('Store img src after flip', NamedChain.write('srcAfterFlip', cGetImageSrc)),
NamedChain.merge(['srcBeforeFlip', 'srcAfterFlip'], 'urls'),
NamedChain.output('urls')
]
);
};
示例4: function
const cFakeEvent = function (name) {
return Chain.label('Fake event',
Chain.op(function (elm: Element) {
const evt = document.createEvent('HTMLEvents');
evt.initEvent(name, true, true);
elm.dom().dispatchEvent(evt);
})
);
};
示例5: cMergeResizeUnmergeMeasureWidth
const cMergeResizeSplitAssertWidth = (label, data) => {
return Chain.label(
`Assert width of table ${label}`,
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cMergeResizeUnmergeMeasureWidth(label, data), 'widths'),
NamedChain.read('widths', cAssertWidths)
])
);
};
示例6: cInsertColumnMeasureWidth
const cAssertWidth = (label, data) => {
return Chain.label(
`Assert width of table ${label} after inserting column`,
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cInsertColumnMeasureWidth(label, data), 'widths'),
NamedChain.read('widths', cAssertWidths)
])
);
};
示例7: 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 ));
}))
]))
]);
};
示例8: function
const cGetInlinePattern = function (patterns: InlinePattern[], space: boolean) {
const asStr = (p: InlinePattern) => {
if (p.type === 'inline-format') {
return p.start + 'TEXT' + p.end + ' = ' + JSON.stringify(p.format);
} else {
const m = (p.start === '' || p.end === '') ? p.start + p.end : p.start + 'TEXT' + p.end;
return m + ' = ' + p.cmd + '(' + JSON.stringify(p.value) + ')';
}
};
return Chain.label('Get inline ' + Arr.map(patterns, asStr).join(', '),
Chain.mapper<{root: HTMLElement, range: Range}, InlinePatternMatch[]>(function (input) {
const dom = DOMUtils(input.root.ownerDocument, { root_element: input.root });
return findNestedInlinePatterns(dom, patterns, input.range, space);
})
);
};
示例9: cInsertTable
const cMergeResizeUnmergeMeasureWidth = (label, data) => {
return Log.chain('TBA', 'Merge cells and resize table, unmerge cells and measure table widths', NamedChain.asChain(
[
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
Chain.label('Insert table', NamedChain.direct('editor', cInsertTable(label, data.html), 'element')),
Chain.label('Drag SE (-100, 0)', NamedChain.read('editor', TableTestUtils.cDragHandle('se', -100, 0))),
Chain.label('Merge table cells', NamedChain.read('editor', TableTestUtils.cMergeCells(data.select))),
Chain.label('Drag SE (-100, 0)', NamedChain.read('editor', TableTestUtils.cDragHandle('se', -100, 0))),
Chain.label('Store width before split', NamedChain.write('widthBefore', TableTestUtils.cGetWidth)),
Chain.label('Split table cells', NamedChain.read('editor', TableTestUtils.cSplitCells)),
Chain.label('Store width after split', NamedChain.write('widthAfter', TableTestUtils.cGetWidth)),
NamedChain.merge(['widthBefore', 'widthAfter'], 'widths'),
NamedChain.output('widths')
]
));
};
示例10: cInsertTable
const cInsertColumnMeasureWidth = (label, data) => {
return Log.chain('TBA', 'Insert column before, insert column after, erase column and measure table widths', NamedChain.asChain(
[
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
Chain.label('Insert table', NamedChain.direct('editor', cInsertTable(label, data.html), 'element')),
Chain.label('Drag SE (-100, 0)', NamedChain.read('editor', TableTestUtils.cDragHandle('se', -100, 0))),
Chain.label('Store width before split', NamedChain.write('widthBefore', TableTestUtils.cGetWidth)),
Chain.label('Insert column before', NamedChain.read('editor', TableTestUtils.cInsertColumnBefore)),
Chain.label('Insert column after', NamedChain.read('editor', TableTestUtils.cInsertColumnAfter)),
Chain.label('Delete column', NamedChain.read('editor', TableTestUtils.cDeleteColumn)),
Chain.label('Store width after split', NamedChain.write('widthAfter', TableTestUtils.cGetWidth)),
NamedChain.merge(['widthBefore', 'widthAfter'], 'widths'),
NamedChain.output('widths')
]
));
};