本文整理汇总了TypeScript中@ephox/agar.GeneralSteps.sequence方法的典型用法代码示例。如果您正苦于以下问题:TypeScript GeneralSteps.sequence方法的具体用法?TypeScript GeneralSteps.sequence怎么用?TypeScript GeneralSteps.sequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.GeneralSteps
的用法示例。
在下文中一共展示了GeneralSteps.sequence方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
UnitTest.asynctest('browser.tinymce.core.api.dom.RangeUtilsTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
const DOM = DOMUtils.DOM;
const viewBlock = ViewBlock();
const createRange = function (sc, so, ec, eo) {
const rng = DOM.createRng();
rng.setStart(sc, so);
rng.setEnd(ec, eo);
return rng;
};
const assertRange = function (expected, actual) {
Assertions.assertEq('startContainers should be equal', true, expected.startContainer === actual.startContainer);
Assertions.assertEq('startOffset should be equal', true, expected.startOffset === actual.startOffset);
Assertions.assertEq('endContainer should be equal', true, expected.endContainer === actual.endContainer);
Assertions.assertEq('endOffset should be equal', true, expected.endOffset === actual.endOffset);
};
const sTestDontNormalizeAtAnchors = Logger.t('Don\'t normalize at anchors', Step.sync(function () {
viewBlock.update('a<a href="#">b</a>c');
const rng1 = createRange(viewBlock.get().firstChild, 1, viewBlock.get().firstChild, 1);
const rng1Clone = rng1.cloneRange();
Assertions.assertEq('label', false, RangeUtils(DOM).normalize(rng1));
assertRange(rng1Clone, rng1);
const rng2 = createRange(viewBlock.get().lastChild, 0, viewBlock.get().lastChild, 0);
const rng2Clone = rng2.cloneRange();
Assertions.assertEq('label', false, RangeUtils(DOM).normalize(rng2));
assertRange(rng2Clone, rng2);
}));
const sTestNormalize = GeneralSteps.sequence([
sTestDontNormalizeAtAnchors
]);
Pipeline.async({}, [
sTestNormalize
], function () {
viewBlock.detach();
success();
}, failure);
});
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const steps = Env.webkit ? [
Logger.t('paste plain text',
GeneralSteps.sequence([
tinyApis.sExecCommand('mceTogglePlainTextPaste'),
Paste.sPaste(editor, { 'text/html': '<p><strong>test</strong></p>'}),
tinyApis.sAssertContent('<p>test</p>'),
tinyApis.sSetContent(''),
tinyApis.sExecCommand('mceTogglePlainTextPaste'),
Paste.sPaste(editor, { 'text/html': '<p><strong>test</strong></p>'}),
tinyApis.sAssertContent('<p><strong>test</strong></p>')
])
)
] : [];
Pipeline.async({}, steps, onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Logger.t('Should insert a before b', GeneralSteps.sequence([
tinyApis.sSetContent('<p>b</p>'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 0),
sSetContent(editor, 'a', {}),
tinyApis.sAssertContent('<p>ab</p>')
])),
Logger.t('Should fill the body with x h1 instead of a before b in a paragraph', GeneralSteps.sequence([
tinyApis.sSetContent('<p>b</p>'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 0),
sSetContentOverride(editor, 'a', '<h1>x</h1>', {}),
tinyApis.sAssertContent('<h1>x</h1>')
]))
], onSuccess, onFailure);
}, {
示例4: function
const sFormatBlockTests = function (editor, tinyApis) {
const sFormatBlockTest = function (name) {
const sFormatBlock: any = wrap(Actions.formatBlock, editor);
return GeneralSteps.sequence([
tinyApis.sSetContent('<p>a</p>'),
tinyApis.sSetCursor([0], 0),
sFormatBlock(name),
tinyApis.sAssertContent('<' + name + '>a</' + name + '>', 'Should be a ' + name + ' block')
]);
};
return GeneralSteps.sequence([
sFormatBlockTest('h1'),
sFormatBlockTest('h2'),
sFormatBlockTest('pre')
]);
};
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('should not get anchor info if not selected node', GeneralSteps.sequence([
tinyApis.sSetContent('<p><a href="http://tinymce.com">tiny</a></p>'),
tinyApis.sSetSelection([0], 1, [0], 1),
tinyApis.sExecCommand('mcelink'),
Chain.asStep({}, [
tinyUi.cWaitForPopup('wait for link popup', 'div[role="dialog"][aria-label="Insert link"]'),
UiFinder.cFindIn('label:contains("Url") + div > input'),
UiControls.cGetValue,
Assertions.cAssertEq('assert value is nothing', '')
])
]))
], onSuccess, onFailure);
}, {
示例6: function
const sManipulateImage = function (message, url) {
return Logger.t(message, GeneralSteps.sequence([
ImageUtils.sLoadImage(editor, url),
tinyApis.sSelect('img', []),
imgOps.sExecToolbar('Flip horizontally'),
imgOps.sExecToolbar('Rotate clockwise'),
imgOps.sExecDialog('Invert'),
imgOps.sExecDialog('Crop'),
imgOps.sExecDialog('Resize'),
imgOps.sExecDialog('Flip vertically'),
imgOps.sExecDialog('Rotate clockwise'),
imgOps.sExecDialog('Brightness'),
imgOps.sExecDialog('Sharpen'),
imgOps.sExecDialog('Contrast'),
imgOps.sExecDialog('Color levels'),
imgOps.sExecDialog('Gamma')
]));
};
示例7: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('image proportion constrains should work directly', GeneralSteps.sequence([
tinyUi.sClickOnToolbar('click image button', 'div[aria-label="Insert/edit image"] button'),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
[
Chain.fromChains([
UiFinder.cFindIn('i.mce-i-browse'),
Mouse.cClick
]),
Chain.fromChains([
Chain.control(
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Width"]'),
UiControls.cGetValue,
Assertions.cAssertEq('should be 1', '1')
]),
Guard.tryUntil('did not find input with value 1', 10, 3000)
)
]),
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Height"]'),
UiControls.cSetValue('5'),
cFakeEvent('change')
]),
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Width"]'),
UiControls.cGetValue,
Assertions.cAssertEq('should have changed to 5', '5')
]),
Chain.fromChains([
UiFinder.cFindIn('div.mce-primary button'),
Mouse.cClick
])
]
)
])
]))
], onSuccess, onFailure);
}, {
示例8: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('test default count of toolbar buttons', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent(tableHtml),
TableTestUtils.sOpenToolbarOn(editor, 'table td', [0]),
Chain.asStep({}, [
tinyUi.cWaitForUi('no context found', 'div.tox-pop div.tox-toolbar'),
Chain.mapper(function (x) {
return SelectorFilter.descendants(x, 'button').length;
}),
Assertions.cAssertEq('has correct count', 8)
])
]))
], onSuccess, onFailure);
}, {