本文整理匯總了TypeScript中@ephox/agar.Assertions.sAssertPresence方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Assertions.sAssertPresence方法的具體用法?TypeScript Assertions.sAssertPresence怎麽用?TypeScript Assertions.sAssertPresence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Assertions
的用法示例。
在下文中一共展示了Assertions.sAssertPresence方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
].concat(assertions.choice.map((c) => [
Assertions.sAssertPresence(
`${c} should NOT be present before clicking`,
{
[c]: 0
},
Element.fromDom(editor.getBody())
),
Mouse.sClickOn(Body.body(), `.tox-collection__item .tox-collection__item-label:contains(${c})`),
Assertions.sAssertPresence(
`${c} should be present`,
{
[c]: 1
},
Element.fromDom(editor.getBody())
)
]).getOr([ ])), onSuccess, onFailure);
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
const doc = TinyDom.fromDom(document);
const body = Element.fromDom(editor.getBody());
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Removing a link with a collapsed selection', [
tinyApis.sSetContent('<p><a href="http://tiny.cloud">tiny</a></p>'),
tinyApis.sSetSelection([0, 0, 0], 2, [0, 0, 0], 2),
Chain.asStep(doc, [
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]')
]),
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'),
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body),
]),
Log.stepsAsStep('TBA', 'Removing a link with some text selected', [
tinyApis.sSetContent('<p><a href="http://tiny.cloud">tiny</a></p>'),
tinyApis.sSetSelection([0, 0, 0], 0, [0, 0, 0], 2),
Chain.asStep(doc, [
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]')
]),
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'),
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body),
]),
Log.stepsAsStep('TBA', 'Removing a link from an image', [
tinyApis.sSetContent('<p><a href="http://tiny.cloud"><img src="http://moxiecode.cachefly.net/tinymce/v9/images/logo.png" /></a></p>'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 1),
Chain.asStep(doc, [
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]')
]),
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'),
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body),
])
], onSuccess, onFailure);
}, {
示例3: TinyUi
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);
}, {
示例4: function
const sAssertPresense = function (selector) {
return Assertions.sAssertPresence('Detect presense of the element', selector, TinyDom.fromDom(editor.getBody()));
};
示例5: function
const sAssertPresence = function (selector) {
return Waiter.sTryUntil('Assert element is present',
Assertions.sAssertPresence('Detect presence of the element', selector, TinyDom.fromDom(editor.getBody())),
100, 1000
);
};