本文整理汇总了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
);
};