本文整理汇总了TypeScript中@ephox/agar.Log.step方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Log.step方法的具体用法?TypeScript Log.step怎么用?TypeScript Log.step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Log
的用法示例。
在下文中一共展示了Log.step方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Theme
UnitTest.asynctest('browser.tinymce.core.init.InitContentBodyDirectionalityTest', (success, failure) => {
Theme();
EditorManager.addI18n('ar', {
Bold: 'Bold test',
_dir: 'rtl'
});
const cGetBodyDir = Chain.mapper((editor: any) => editor.getBody().dir);
const cSetContent = (content: string) => Chain.mapper(function (editor: Editor) {
return editor.editorCommands.execCommand('mceSetContent', false, content);
});
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
]);
};
Pipeline.async({}, [
Log.step('TBA', 'Test default directionality of the editor when set to use a rtl language', makeStep(
{
base_url: '/project/tinymce/js/tinymce',
language: 'ar'
},
'Directionality should be set to `rtl` by default if the editor is set to a rtl language',
'rtl'
)),
Log.step('TBA', 'Test directionality of the editor when set using the config option while localized using a rtl language', makeStep(
{
base_url: '/project/tinymce/js/tinymce',
language: 'ar',
directionality: 'ltr'
},
'Directionality should be set to `ltr` as per the config option setting',
'ltr'
)),
Log.step('TBA', 'Test directionality of editor when using a language with no directionality set', makeStep(
{
base_url: '/project/tinymce/js/tinymce',
language: 'en'
},
'Directionality should not be set if the editor language does not have a directionality',
''
)),
], success, failure);
});
示例2: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
Pipeline.async({}, [ Log.step('TBA', 'Print: Assert print button exists',
tinyUi.sWaitForUi('check print button exists', 'button[aria-label="Print"]')
)], onSuccess, onFailure);
}, {
示例3:
TinyLoader.setup(function (editor, onSuccess, onFailure) {
Pipeline.async({}, [ Log.step('TBA', 'FullScreen: Assert isFullscreen api function is present and fullscreen button is absent',
Step.sync(() => {
RawAssertions.assertEq('should have isFullsceen api function', false, editor.plugins.fullscreen.isFullscreen());
RawAssertions.assertEq('should not have the fullscreen button', 'undefined', typeof editor.ui.registry.getAll().buttons.fullscreen);
})
)], onSuccess, onFailure);
}, {
示例4: sCheckSections
const sCheckTitleSection = (exists: boolean, value: Option<boolean>) => Log.step('TBA', 'Link: sCheckTitleSection',
sCheckSections([
{
setting: { key: 'link_title', value },
selector: 'label:contains("Title")',
exists
}
])
);
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Editor is responsive after using a plugin that throws an error during init', [
tinyApis.sSetContent('<p>a</p>'),
tinyApis.sAssertContent('<p>a</p>'),
]),
Log.step('TBA', 'Failed plugin shouldn\'t be registered', Step.sync(() => {
Assertions.assertEq('Plugin shouldn\'t be registered', undefined, editor.plugins.errorplugin);
})),
Log.step('TBA', 'Notification opened detailing plugin failed to init', Step.sync(() => {
const notifications = editor.notificationManager.getNotifications();
Assertions.assertEq('Notification should exist', 1, notifications.length);
const notification = notifications[0];
Assertions.assertEq('Notification should have a message', 'Failed to initialize plugin: errorplugin', notification.settings.text);
Assertions.assertEq('Notification should be an error', 'error', notification.settings.type);
notification.close();
}))
], onSuccess, onFailure);
}, {
示例6: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'NonBreaking: Undo level on insert tab', [
tinyActions.sContentKeystroke(Keys.tab(), {}),
tinyApis.sAssertContent('<p> </p>'),
Step.sync(function () {
editor.undoManager.undo();
}),
tinyApis.sAssertContent('')
]),
Log.step('TBA', 'NonBreaking: Prevent default and other handlers on insert tab',
Step.sync(function () {
const args = editor.fire('keydown', { keyCode: VK.TAB });
RawAssertions.assertEq('Default should be prevented', true, args.isDefaultPrevented());
RawAssertions.assertEq('Should not propagate', true, args.isImmediatePropagationStopped());
})
)
], onSuccess, onFailure);
}, {
示例7: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const doc = TinyDom.fromDom(document);
const sAssertInputValue = (expected: string, group: string) => Logger.t('Assert input value', Chain.asStep({ }, [
TestLinkUi.cFindInDialog('label:contains("' + group + '") + input'),
UiControls.cGetValue,
Assertions.cAssertEq('Checking input value', expected)
]));
// FIX: Dupe
const sAssertUrlStructure = (expected: (s, str, arr) => any) => Logger.t('Assert url structure', Chain.asStep({ }, [
TestLinkUi.cFindInDialog('label:contains("URL") + .tox-form__controls-h-stack input'),
Chain.op((urlinput) => {
Assertions.assertStructure(
'Checking content of url input',
ApproxStructure.build(expected),
urlinput
);
})
]));
const testChangingAnchorValue = Log.stepsAsStep('TBA', 'Link: Switching anchor changes the href and text', [
tinyApis.sSetContent('<p><a name="anchor1"></a>Our Anchor1</p><p><a name="anchor2"></a>Our Anchor2</p>'),
TestLinkUi.sOpenLinkDialog,
TestLinkUi.sSetHtmlSelectValue('Anchor', '#anchor2'),
TestLinkUi.sAssertDialogContents({
href: '#anchor2',
text: 'anchor2',
title: '',
anchor: '#anchor2',
target: ''
}),
TestLinkUi.sSetHtmlSelectValue('Anchor', '#anchor1'),
TestLinkUi.sAssertDialogContents({
href: '#anchor1',
text: 'anchor1',
title: '',
anchor: '#anchor1',
target: ''
}),
// Change the text ...so text won't change, but href will still
TestLinkUi.sSetInputFieldValue('Text to display', 'Other text'),
TestLinkUi.sSetHtmlSelectValue('Anchor', '#anchor2'),
TestLinkUi.sAssertDialogContents({
href: '#anchor2',
text: 'Other text',
title: '',
anchor: '#anchor2',
target: ''
}),
TestLinkUi.sClickSave,
TestLinkUi.sAssertContentPresence(tinyApis, {
'a[href]': 1,
'a[href="#anchor2"]:contains("Other text")': 1
})
]);
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")`);
})
])
])
]);
const testChangingUrlValueWithKeyboard = Log.step('TBA', 'Link: With Keyboard',
testChangingUrlValueWith(GeneralSteps.sequence([
Keyboard.sKeydown(doc, Keys.enter(), { })
]))
);
const testChangingUrlValueWithMouse = Log.step('TBA', 'Link: With Mouse',
//.........这里部分代码省略.........
示例8: sAssertErrorMessage
const sTestImageToolsError = (testId, description, proxyUrl, apiKey, errorMessage) => Log.step(
testId, description, GeneralSteps.sequence([
uploadHandlerState.sResetState,
Step.label('Set image proxy URL', tinyApis.sSetSetting('imagetools_proxy', proxyUrl)),
Step.label('Set API key', tinyApis.sSetSetting('api_key', apiKey)),
ImageUtils.sLoadImage(editor, corsUrl),
Step.label('Select image', tinyApis.sSelect('img', [])),
ImageUtils.sExecCommand(editor, 'mceImageFlipHorizontal'),
sAssertErrorMessage(errorMessage),
sCloseErrorMessage,
Step.label('Clear editor content', tinyApis.sSetContent(''))
])
);
示例9: Plugin
UnitTest.asynctest('browser.tinymce.plugins.importcss.ImportCssGroupsTest', (success, failure) => {
Plugin();
Theme();
const sTestEditorWithSettings = (assertions, pluginSettings) => Step.async((onStepSuccess, onStepFailure) => {
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);
}, {
plugins: 'importcss',
toolbar: 'styleselect',
theme: 'silver',
content_css: pluginSettings.content_css,
importcss_append: pluginSettings.importcss_append,
importcss_selector_filter: pluginSettings.importcss_selector_filter,
importcss_file_filter: pluginSettings.importcss_file_filter,
importcss_groups: pluginSettings.importcss_groups,
importcss_selector_converter: pluginSettings.importcss_selector_converter,
importcss_exclusive: pluginSettings.importcss_exclusive,
base_url: '/project/tinymce/js/tinymce'
}, () => onStepSuccess(), onStepFailure);
});
Pipeline.async({ }, [
Log.step(
'TBA',
'importcss: content_css with three files, append false, groups with overall selector converter',
sTestEditorWithSettings(
{
navigation: [
{ item: 'Other', subitems: [ 'h1.red.DDD', 'p.other.DDD', 'span.inline.DDD' ] },
{ item: 'Advanced', subitems: [ 'h2.advanced.CCC', 'h3.advanced.CCC', 'h4.advanced.CCC' ] }
],
choice: {
keysBeforeExecute: [ Keys.right() ],
presence: 'span.converted'
}
},
{
content_css: [
'/project/tinymce/src/plugins/importcss/test/css/basic.css',
'/project/tinymce/src/plugins/importcss/test/css/advanced.css',
'/project/tinymce/src/plugins/importcss/test/css/other-adv.css'
],
importcss_append: false,
importcss_groups: [
{ title: 'Advanced', filter: /.adv/, custom: '.CCC' },
{ title: 'Other', custom: '.DDD' }
],
importcss_selector_converter: (selector, group) => {
return {
title: selector + group.custom,
classes: [ 'converted' ],
inline: 'span'
};
}
}
)
),
Log.step(
'TBA',
'importcss: content_css with three files, append false, groups with group selector converters',
sTestEditorWithSettings(
{
//.........这里部分代码省略.........