本文整理汇总了TypeScript中@ephox/agar.Step.async方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Step.async方法的具体用法?TypeScript Step.async怎么用?TypeScript Step.async使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Step
的用法示例。
在下文中一共展示了Step.async方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: TinyApis
const sTestEditorWithSettings = (categories, databaseUrl) => Step.async((onStepSuccess, onStepFailure) => {
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
tinyApis.sFocus,
tinyUi.sClickOnToolbar('click emoticons', 'button'),
Chain.asStep({}, [
tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
]),
Waiter.sTryUntil(
'Wait for emojis to load',
UiFinder.sNotExists(Body.body(), '.tox-spinner'),
100,
1000
),
Chain.asStep(Body.body(), [
UiFinder.cFindAllIn('[role="tab"]'),
Chain.mapper((elements: Element[]) => {
return Arr.map(elements, (elm: Element) => {
return elm.dom().textContent;
});
}),
Assertions.cAssertEq('Categories match', categories)
])
], onSuccess, onFailure);
}, {
plugins: 'emoticons',
toolbar: 'emoticons',
theme: 'silver',
base_url: '/project/tinymce/js/tinymce',
emoticons_database_url: databaseUrl
}, onStepSuccess, onStepFailure);
});
示例2: function
UnitTest.asynctest('browser.tinymce.ui.BoxUtilsMeasureBoxIframeDisplayNoneTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
ModernTheme();
Pipeline.async({}, [
Logger.t(
'firefox specific test, boxutils should not throw error when used on hidden iframe',
Step.async(function (next, die) {
const iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
iframe.addEventListener('load', function () {
try {
const measured = BoxUtils.measureBox(iframe.contentDocument.body.firstChild, 'border');
Assertions.assertEq('should return 0', 0, measured.top);
iframe.parentNode.removeChild(iframe);
next();
} catch (e) {
die('Should not throw error, ' + e.message);
}
}, false);
iframe.contentDocument.open();
iframe.contentDocument.write('<html><body><div>a</div></body></html>');
iframe.contentDocument.close();
})
)
], function () {
success();
}, failure);
});
示例3: function
const sBlobToBase64 = function () {
return Step.async(function (next) {
const base64 = 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
const blob = base64ToBlob(base64, 'image/gif');
Conversions.blobToBase64(blob).then(function (convertedBase64) {
Assertions.assertEq('Not the correct base64', base64, convertedBase64);
next();
});
});
};
示例4: next
const shouldFail = (label, conf, asserter) => {
return Step.async(function (next, die) {
try {
windowManager.open(conf, {}, Fun.noop);
} catch (err) {
asserter(err);
return next();
}
die('This should throw a configuration error: ' + label);
});
};
示例5: function
const sCreateInlineEditors = function (html) {
return Step.async(function (done) {
viewBlock.update(html);
EditorManager.init({
selector: '.tinymce',
inline: true,
skin_url: '/project/js/tinymce/skins/lightgray'
}).then(function () {
done();
});
});
};
示例6: function
const sLoadImage = function (editor, url, size?) {
return Step.async(function (done) {
const img = new Image();
img.onload = function () {
editor.setContent(`<p><img src="${url}" ${size ? `width="${size.width}" height="${size.height}"` : ''} /></p>`);
editor.focus();
done();
};
img.src = url;
});
};
示例7: function
const sLoadImage = function (editor, url) {
return Step.async(function (done) {
const img = new Image();
img.onload = function () {
editor.setContent('<p><img src="' + url + '" /></p>');
editor.focus();
done();
};
img.src = url;
});
};
示例8: TinyUi
const sTestEditorWithSettings = (assertions, pluginSettings) => Step.async((onStepSuccess, onStepFailure) => {
TinyLoader.setup((editor, onSuccess, onFailure) => {
const doc = Element.fromDom(document);
const tinyUi = TinyUi(editor);
const sOpenStyleMenu = GeneralSteps.sequence([
tinyUi.sClickOnToolbar('Clicking on the styleselect dropdown', 'button')
]);
const navigationSteps = MenuNavigationTestUtils.generateNavigation(doc, assertions.navigation);
Pipeline.async({}, Arr.flatten([
[
Assertions.sAssertPresence(
`${assertions.choice.presence} should NOT be present`,
{
[assertions.choice.presence]: 0
},
Element.fromDom(editor.getBody())
)
],
[ sOpenStyleMenu ],
navigationSteps,
Arr.map(assertions.choice.keysBeforeExecute, (k) => Keyboard.sKeydown(doc, k, { })),
[ Keyboard.sKeydown(doc, Keys.enter(), { }) ],
[
Assertions.sAssertPresence(
`${assertions.choice.presence} should now be present`,
{
[assertions.choice.presence]: 1
},
Element.fromDom(editor.getBody())
)
]
]), onSuccess, onFailure);
}, {
plugins: 'importcss',
toolbar: 'styleselect',
theme: 'silver',
content_css: pluginSettings.content_css,
importcss_append: pluginSettings.importcss_append,
importcss_selector_filter: pluginSettings.importcss_selector_filter,
importcss_file_filter: pluginSettings.importcss_file_filter,
importcss_groups: pluginSettings.importcss_groups,
importcss_selector_converter: pluginSettings.importcss_selector_converter,
importcss_exclusive: pluginSettings.importcss_exclusive,
base_url: '/project/tinymce/js/tinymce'
}, () => onStepSuccess(), onStepFailure);
});
示例9: function
const sExec = function (execFromToolbar, label) {
return Logger.t(`Execute ${label}`, Step.async(function (next, die) {
const imgEl = TinyDom.fromDom(editor.selection.getNode());
const origUrl = Attr.get(imgEl, 'src');
Pipeline.async({}, [
Chain.asStep(imgEl, [
Mouse.cClick,
ui.cWaitForPopup('wait for Imagetools toolbar', '.tox-pop__dialog div'),
execFromToolbar ? cClickToolbarButton(label) : cExecCommandFromDialog(label)
]),
sWaitForUrlChange(imgEl, origUrl)
], function () {
next();
}, die);
}));
};
示例10: function
const sExec = function (execFromToolbar, label) {
return Step.async(function (next, die) {
const imgEl = TinyDom.fromDom(editor.selection.getNode());
const origUrl = Attr.get(imgEl, 'src');
Pipeline.async({}, [
Chain.asStep(imgEl, [
Mouse.cClick,
ui.cWaitForPopup('wait for Imagetools toolbar', 'div[aria-label="Inline toolbar"][role="dialog"]'),
execFromToolbar ? cClickToolbarButton(label) : cExecCommandFromDialog(label)
]),
sWaitForUrlChange(imgEl, origUrl)
], function () {
next();
}, die);
});
};