本文整理匯總了TypeScript中@ephox/agar.Waiter類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Waiter類的具體用法?TypeScript Waiter怎麽用?TypeScript Waiter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Waiter類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const sTestPlaceholder = function (ui, editor, apis, url, expected, struct) {
return GeneralSteps.sequence([
Utils.sOpenDialog(ui),
Utils.sSetFormItemNoEvent(ui, url),
ui.sClickOnUi('click checkbox', 'div.mce-primary > button'),
Utils.sAssertEditorContent(apis, editor, expected),
Waiter.sTryUntil('Wait for structure check',
apis.sAssertContentStructure(struct),
100, 3000),
apis.sSetContent('')
]);
};
示例2: function
const sTestPlaceholder = function (ui, editor, apis, url, expected, struct) {
return Logger.t(`Test placeholder ${expected}`, GeneralSteps.sequence([
Utils.sOpenDialog(ui),
Utils.sSetFormItemNoEvent(ui, url),
ui.sClickOnUi('click checkbox', Utils.selectors.saveButton),
Utils.sAssertEditorContent(apis, editor, expected),
Waiter.sTryUntil('Wait for structure check',
apis.sAssertContentStructure(struct),
100, 3000),
apis.sSetContent('')
]));
};
示例3: function
const sParseStyles = function (editor) {
return GeneralSteps.sequence([
Step.sync(function () {
editor.setContent('<html><head><style>p {text-align:right}</style></head><body dir="rtl"><p>Test</p></body></html>');
}),
Waiter.sTryUntil(
'Expected styles where not added',
Step.sync(function () {
Assertions.assertEq('Styles added to iframe document', 'right', editor.dom.getStyle(editor.getBody().firstChild, 'text-align', true));
}
), 10, 3000)
]);
};
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, Arr.flatten([
[
Logger.t('Fullscreen toggle scroll state', GeneralSteps.sequence([
tinyApis.sExecCommand('mceFullScreen'),
sAssertScroll(editor, true),
tinyApis.sExecCommand('mceFullScreen'),
sAssertScroll(editor, false)
])),
Logger.t('Editor size increase based on content size', GeneralSteps.sequence([
tinyApis.sSetContent('<div style="height: 5000px;">a</div>'),
Waiter.sTryUntil('wait for editor height', sAssertEditorHeightAbove(editor, 5000), 10, 3000)
])),
Logger.t('Editor size decrease based on content size', GeneralSteps.sequence([
tinyApis.sSetContent('<div style="height: 1000px;">a</div>'),
Waiter.sTryUntil('wait for editor height', sAssertEditorHeightBelow(editor, 2000), 10, 3000)
]))
],
// These tests doesn't work on phantom since measuring things seems broken there
navigator.userAgent.indexOf('PhantomJS') === -1 ? [
Logger.t('Editor size decrease content to 1000 based and restrict by max height', GeneralSteps.sequence([
tinyApis.sSetSetting('autoresize_max_height', 200),
tinyApis.sSetContent('<div style="height: 1000px;">a</div>'),
Waiter.sTryUntil('wait for editor height', sAssertEditorHeightBelow(editor, 500), 10, 3000),
tinyApis.sSetSetting('autoresize_max_height', 0)
])),
Logger.t('Editor size decrease content to 10 and set min height to 500', GeneralSteps.sequence([
tinyApis.sSetSetting('autoresize_min_height', 500),
tinyApis.sSetContent('<div style="height: 10px;">a</div>'),
Waiter.sTryUntil('wait for editor height', sAssertEditorHeightAbove(editor, 300), 10, 3000),
tinyApis.sSetSetting('autoresize_min_height', 0)
]))
] : []
]), onSuccess, onFailure);
}, {
示例5:
const sAssertColour = (label: string, expected: string, labelText: string) =>
Logger.t(
label,
Waiter.sTryUntil(
'Waiting until hex updates the other fields',
Chain.asStep(component.element(), [
UiFinder.cFindIn(`label:contains("${labelText}") + input`),
UiControls.cGetValue,
Assertions.cAssertEq('Checking value in input', expected)
]),
100,
1000
)
);
示例6: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const api = TinyApis(editor);
const ui = TinyUi(editor);
// Cut doesn't seem to work in webdriver mode on ie, firefox is producing moveto not supported, edge fails if it's not observed
Pipeline.async({}, (platform.browser.isIE() || platform.browser.isFirefox() || platform.browser.isEdge()) ? [] : [
api.sSetContent('<p>abc</p>'),
api.sSetSelection([0, 0], 1, [0, 0], 2),
ui.sClickOnMenu('Click Edit menu', 'button:contains("Edit")'),
ui.sWaitForUi('Wait for dropdown', '.mce-floatpanel[role="application"]'),
RealMouse.sClickOn('.mce-i-cut'),
Waiter.sTryUntil('Cut is async now, so need to wait for content', api.sAssertContent('<p>ac</p>'), 100, 1000)
], onSuccess, onFailure);
}, {
示例7: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const ui = TinyUi(editor);
Pipeline.async({}, [
Utils.sOpenDialog(ui),
ui.sClickOnUi('Click on close button', 'button:contains("Ok")'),
Waiter.sTryUntil(
'Wait for dialog to close',
UiFinder.sNotExists(TinyDom.fromDom(document.body), 'div[aria-label="Insert/edit media"][role="dialog"]'),
50, 5000
)
], onSuccess, onFailure);
}, {
示例8: function
const sParseStyles = function (editor) {
return Logger.t('Parse styles', GeneralSteps.sequence([
Step.sync(function () {
editor.setContent('<html><head><style>p {text-transform: uppercase}</style></head><body dir="rtl"><p>Test</p></body></html>');
}),
Waiter.sTryUntil(
'Expected styles were added',
Step.sync(function () {
Assertions.assertEq('Styles added to iframe document', 'uppercase', editor.dom.getStyle(editor.getBody().firstChild, 'text-transform', true));
Assertions.assertEq('Styles not added to actual element', '', editor.dom.getStyle(editor.getBody().firstChild, 'text-transform', false));
}
), 10, 3000)
]));
};
示例9: function
const sClickFocusedButton = function (selector) {
return GeneralSteps.sequence([
Waiter.sTryUntil(
'Focus was not moved to the expected element',
FocusTools.sIsOnSelector('Is not on the right element', TinyDom.fromDom(document), selector),
10,
1000
),
Chain.asStep(TinyDom.fromDom(document), [
FocusTools.cGetFocused,
Mouse.cTrueClick
])
]);
};