本文整理匯總了TypeScript中@ephox/mcagar.TinyDom類的典型用法代碼示例。如果您正苦於以下問題:TypeScript TinyDom類的具體用法?TypeScript TinyDom怎麽用?TypeScript TinyDom使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TinyDom類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: sAssertUrlStructure
const testChangingUrlValueWith = (sChooseItem: Step<any, any>) => Log.stepsAsStep('TBA', 'Link: Choosing something in the urlinput changes text and value', [
tinyApis.sSetContent('<h1>Header One</h1><h2 id="existing-id">Header2</h2>'),
TestLinkUi.sOpenLinkDialog,
Keyboard.sKeydown(doc, Keys.down(), { }),
UiFinder.sWaitForVisible('Waiting for dropdown', TinyDom.fromDom(document.body), '.tox-menu'),
sChooseItem,
sAssertUrlStructure((s, str, _arr) => {
return s.element('input', {
value: str.startsWith('#h_')
});
}),
sAssertInputValue('Header One', 'Text to display'),
TestLinkUi.sAssertContentPresence(tinyApis, {
'h1[id]': 0,
'h2[id]': 1
}),
TestLinkUi.sClickSave,
TestLinkUi.sAssertContentPresence(tinyApis, {
'h1[id]': 1
}),
// Check that the h1's id value is referred to by a link containing dog
Chain.asStep(TinyDom.fromDom(editor.getBody()), [
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), UiFinder.cFindIn('h1'), 'h1'),
NamedChain.direct('h1', Chain.mapper((h1) => Attr.get(h1, 'id')), 'h1-id'),
NamedChain.bundle((obj) => {
return UiFinder.findIn(obj[NamedChain.inputName()], `a[href="#${obj['h1-id']}"]:contains("Header One")`);
})
])
])
]);
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const doc = TinyDom.fromDom(document);
Pipeline.async({}, [
TestLinkUi.sClearHistory,
Log.stepsAsStep('TBA', 'Checking only choosing link and submitting works', [
Step.sync(() => {
editor.execCommand('mceLink');
}),
UiFinder.sWaitForVisible('wait for link dialog', TinyDom.fromDom(document.body), '[role="dialog"]'),
FocusTools.sTryOnSelector('Selector should be in first field of dialog', doc, '.tox-dialog input'),
FocusTools.sSetActiveValue(doc, 'http://goo'),
Chain.asStep(doc, [
FocusTools.cGetFocused,
TestLinkUi.cFireEvent('input')
]),
Keyboard.sKeydown(doc, Keys.enter(), { }),
Waiter.sTryUntil(
'Waiting for link to be inserted',
tinyApis.sAssertContentPresence({
'a[href="http://goo"]': 1
}),
100,
1000
)
]),
TestLinkUi.sClearHistory,
], onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const doc = TinyDom.fromDom(document);
Pipeline.async({},
Log.steps('TBA', 'Link: complex selections should preserve the text', [
TestLinkUi.sClearHistory,
tinyApis.sSetContent('<p><strong>word</strong></p><p><strong>other</strong></p>'),
tinyApis.sSetSelection([0], 0, [1], 1),
tinyApis.sExecCommand('mcelink'),
UiFinder.sWaitForVisible('wait for link dialog', TinyDom.fromDom(document.body), '[role="dialog"]'),
FocusTools.sSetActiveValue(doc, 'http://something'),
Keyboard.sKeydown(doc, Keys.enter(), { }),
Waiter.sTryUntil(
'Wait until link is inserted',
tinyApis.sAssertContentPresence({
'a[href="http://something"]': 2,
'p:contains(word)': 1,
'p:contains(other)': 1,
'p': 2
}),
100,
1000
),
TestLinkUi.sClearHistory
])
, onSuccess, onFailure);
}, {
示例4:
const sClickOnConfirmDialog = (label: string, state: boolean) => Logger.t('Click on confirm dialog', GeneralSteps.sequence([
Mouse.sClickOn(TinyDom.fromDom(document.body), '[role="dialog"].tox-confirm-dialog button:contains("' + (state ? 'Yes' : 'No') + '")'),
Waiter.sTryUntil(
'Waiting for confirm dialog to go away',
UiFinder.sNotExists(TinyDom.fromDom(document.body), '.tox-confirm-dialog'),
100,
1000
)
]));
示例5:
const sClickDialogButton = (label: string, isSave: boolean) => Logger.t('Close dialog and wait to confirm dialog goes away', GeneralSteps.sequence([
Mouse.sClickOn(TinyDom.fromDom(document.body), '[role="dialog"].tox-dialog button:contains("' + (isSave ? 'Save' : 'Cancel') + '")'),
Waiter.sTryUntil(
'Waiting for confirm dialog to go away',
UiFinder.sNotExists(TinyDom.fromDom(document.body), '.tox-confirm-dialog'),
100,
1000
)
]));
示例6: 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
])
]);
};
示例7: 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))
]));
};
示例8: function
const sWaitForAndAssertNotification = function (expected) {
return Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Could not find notification', 'div.mce-notification-inner'),
Chain.mapper(Html.get),
Assertions.cAssertHtml('Plugin list html does not match', expected)
]);
};
示例9: function
const sAssertErrorMessage = function (html) {
return Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Could not find notification', '.mce-notification-inner'),
Chain.mapper(Html.get),
Assertions.cAssertHtml('Message html does not match', html)
]);
};
示例10: function
const sAssertPluginList = function (html) {
return Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Could not find notification', 'div.mce-floatpanel ul'),
Chain.mapper(Html.get),
Assertions.cAssertHtml('Plugin list html does not match', html)
]);
};