本文整理汇总了TypeScript中@ephox/agar.Assertions.cAssertEq方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Assertions.cAssertEq方法的具体用法?TypeScript Assertions.cAssertEq怎么用?TypeScript Assertions.cAssertEq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Assertions
的用法示例。
在下文中一共展示了Assertions.cAssertEq方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sAssertWidthValue = function (ui, value) {
return Waiter.sTryUntil('Wait for new width value',
Chain.asStep({}, [
cGetWidthValue(ui),
Assertions.cAssertEq('Assert size value', value)
]), 1, 3000
);
};
示例2: cFindInDialog
const sAssertFieldValue = (ui, selector: string, value) => {
return Waiter.sTryUntil(`Wait for new ${selector} value`,
Chain.asStep({}, [
cFindInDialog(ui, selector),
UiControls.cGetValue,
Assertions.cAssertEq(`Assert ${value} value`, value)
]), 20, 3000
);
};
示例3: function
const sAssertSourceValue = function (ui, value) {
return Waiter.sTryUntil('Wait for source value',
Chain.asStep({}, [
cFindFilepickerInput(ui, 'Source'),
UiControls.cGetValue,
Assertions.cAssertEq('Assert source value', value)
]), 1, 3000
);
};
示例4: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
Logger.t('image proportion constrains should work directly', GeneralSteps.sequence([
tinyUi.sClickOnToolbar('click image button', 'div[aria-label="Insert/edit image"] button'),
Chain.asStep({}, [
Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
[
Chain.fromChains([
UiFinder.cFindIn('i.mce-i-browse'),
Mouse.cClick
]),
Chain.fromChains([
Chain.control(
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Width"]'),
UiControls.cGetValue,
Assertions.cAssertEq('should be 1', '1')
]),
Guard.tryUntil('did not find input with value 1', 10, 3000)
)
]),
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Height"]'),
UiControls.cSetValue('5'),
cFakeEvent('change')
]),
Chain.fromChains([
UiFinder.cFindIn('input[aria-label="Width"]'),
UiControls.cGetValue,
Assertions.cAssertEq('should have changed to 5', '5')
]),
Chain.fromChains([
UiFinder.cFindIn('div.mce-primary button'),
Mouse.cClick
])
]
)
])
]))
], onSuccess, onFailure);
}, {
示例5: cProcessPre
TinyLoader.setup(function (editor, onSuccess, onFailure) {
Pipeline.async({}, [
Logger.t('Paste pre process only', Chain.asStep(editor, [
cProcessPre('a', true, preProcessHandler),
Assertions.cAssertEq('Should be preprocessed by adding a X', { content: 'aX', cancelled: false })
])),
Logger.t('Paste pre/post process passthough as is', Chain.asStep(editor, [
cProcessPrePost('a', true, Fun.noop, Fun.noop),
Assertions.cAssertEq('Should be unchanged', { content: 'a', cancelled: false })
])),
Logger.t('Paste pre/post process assert internal false', Chain.asStep(editor, [
cProcessPrePost('a', false, assertInternal(false), assertInternal(false)),
Assertions.cAssertEq('Should be unchanged', { content: 'a', cancelled: false })
])),
Logger.t('Paste pre/post process assert internal true', Chain.asStep(editor, [
cProcessPrePost('a', true, assertInternal(true), assertInternal(true)),
Assertions.cAssertEq('Should be unchanged', { content: 'a', cancelled: false })
])),
Logger.t('Paste pre/post process alter on preprocess', Chain.asStep(editor, [
cProcessPrePost('a', true, preProcessHandler, Fun.noop),
Assertions.cAssertEq('Should be preprocessed by adding a X', { content: 'aX', cancelled: false })
])),
Logger.t('Paste pre/post process alter on postprocess', Chain.asStep(editor, [
cProcessPrePost('a<b>b</b>c', true, Fun.noop, postProcessHandler(editor)),
Assertions.cAssertEq('Should have all b elements removed', { content: 'abc', cancelled: false })
])),
Logger.t('Paste pre/post process alter on preprocess/postprocess', Chain.asStep(editor, [
cProcessPrePost('a<b>b</b>c', true, preProcessHandler, postProcessHandler(editor)),
Assertions.cAssertEq('Should have all b elements removed and have a X added', { content: 'abcX', cancelled: false })
])),
Logger.t('Paste pre/post process prevent default on preProcess', Chain.asStep(editor, [
cProcessPrePost('a<b>b</b>c', true, preventHandler, postProcessHandler(editor)),
Assertions.cAssertEq('Should have all b elements removed and be cancelled', { content: 'a<b>b</b>c', cancelled: true })
])),
Logger.t('Paste pre/post process prevent default on postProcess', Chain.asStep(editor, [
cProcessPrePost('a<b>b</b>c', true, preProcessHandler, preventHandler),
Assertions.cAssertEq('Should have a X added and be cancelled', { content: 'a<b>b</b>cX', cancelled: true })
]))
], onSuccess, onFailure);
}, {
示例6: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
const doc = Element.fromDom(document);
const body = Body.body();
Pipeline.async({},
Log.steps('TBA', 'Emoticons: Open dialog, verify custom categories listed and search for custom emoticon', [
tinyApis.sFocus,
tinyUi.sClickOnToolbar('click emoticons', 'button'),
Chain.asStep({}, [
tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
]),
FocusTools.sTryOnSelector('Focus should start on input', doc, 'input'),
Chain.asStep(body, [
UiFinder.cFindIn('[role="tablist"]'),
Assertions.cAssertStructure('check custom categories are shown', ApproxStructure.build((s, str, arr) => {
return s.element('div', {
children: [
tabElement(s, str, arr)('All'),
tabElement(s, str, arr)('People'),
tabElement(s, str, arr)('User Defined')
]
});
})),
]),
FocusTools.sSetActiveValue(doc, 'clock'),
Chain.asStep(doc, [
FocusTools.cGetFocused,
cFakeEvent('input')
]),
Waiter.sTryUntil(
'Wait until clock is the first choice (search should filter)',
Chain.asStep(body, [
UiFinder.cFindIn('.tox-collection__item:first'),
Chain.mapper((item) => {
return Attr.get(item, 'data-collection-item-value');
}),
Assertions.cAssertEq('Search should show custom clock', 'â˛')
]),
100,
1000
),
Keyboard.sKeydown(doc, Keys.tab(), {}),
FocusTools.sTryOnSelector('Focus should have moved to collection', doc, '.tox-collection__item'),
Keyboard.sKeydown(doc, Keys.enter(), {}),
Waiter.sTryUntil(
'Waiting for content update',
tinyApis.sAssertContent('<p>â˛</p>'),
100,
1000
)
])
, onSuccess, onFailure);
}, {
示例7: function
const sAssertEmbedData = function (ui, content) {
return GeneralSteps.sequence([
ui.sClickOnUi('Switch to Embed tab', '.tox-tab:contains("Embed")'),
Waiter.sTryUntil('Textarea should have a proper value',
Chain.asStep(Body.body(), [
cFindInDialog(selectors.embed)(ui),
UiControls.cGetValue,
Assertions.cAssertEq('embed content', content)
]), 1, 3000),
ui.sClickOnUi('Switch to General tab', '.tox-tab:contains("General")')
]);
};
示例8:
(editor: Editor, onSuccess, onFailure) => {
const replacedElem = Element.fromDom(editor.getElement());
Pipeline.async({ }, [
Chain.asStep(Body.body(), [
UiFinder.cFindIn(`#${Attr.get(replacedElem, 'id')}`),
Chain.binder((elem) => Traverse.nextSibling(elem).fold(() => Result.error('Replaced element has no next sibling'), Result.value)),
Chain.mapper((elem) => Class.has(elem, 'tox-tinymce')),
Assertions.cAssertEq('Replaced element\'s next sibling has "tox-tinymce" class', true)
])
], onSuccess, onFailure);
},
示例9: cSetContent
const makeStep = (config, label, expected) => {
return Chain.asStep({}, [
McEditor.cFromSettings(config),
NamedChain.asChain([
NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
NamedChain.direct('editor', cSetContent('<p>Hello world!</p>'), ''),
NamedChain.direct('editor', cGetBodyDir, 'editorBodyDirectionality'),
NamedChain.direct('editorBodyDirectionality', Assertions.cAssertEq(label, expected), 'assertion'),
NamedChain.output('editor')
]),
McEditor.cRemove
]);
};