本文整理匯總了TypeScript中@ephox/agar.Log類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Log類的具體用法?TypeScript Log怎麽用?TypeScript Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Log類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const sTestPaste = function (editor, tinyApis) {
return Log.stepsAsStep('TBA', 'Paste: Paste external content', [
sPaste(editor, tinyApis, '<p>abc</p>', { 'text/plain': 'X', 'text/html': '<p>X</p>' }, [0, 0], 0, [0, 0], 3),
sWaitForProcessEvents,
sAssertLastPreProcessEvent({ internal: false, content: 'X' }),
sAssertLastPostProcessEvent({ internal: false, content: 'X' })
]),
Log.stepsAsStep('TBA', 'Paste: Paste external content treated as plain text', [
sPaste(editor, tinyApis, '<p>abc</p>', { 'text/html': '<p>X</p>' }, [0, 0], 0, [0, 0], 3),
sWaitForProcessEvents,
sAssertLastPreProcessEvent({ internal: false, content: 'X' }),
sAssertLastPostProcessEvent({ internal: false, content: 'X' })
]),
Log.stepsAsStep('TBA', 'Paste: Paste internal content with mark', [
sPaste(editor, tinyApis, '<p>abc</p>', { 'text/plain': 'X', 'text/html': InternalHtml.mark('<p>X</p>') }, [0, 0], 0, [0, 0], 3),
sWaitForProcessEvents,
sAssertLastPreProcessEvent({ internal: true, content: '<p>X</p>' }),
sAssertLastPostProcessEvent({ internal: true, content: '<p>X</p>' })
]),
Log.stepsAsStep('TBA', 'Paste: Paste internal content with mime', [
sPaste(editor, tinyApis, '<p>abc</p>',
{ 'text/plain': 'X', 'text/html': '<p>X</p>', 'x-tinymce/html': '<p>X</p>' },
[0, 0], 0, [0, 0], 3
),
sWaitForProcessEvents,
sAssertLastPreProcessEvent({ internal: true, content: '<p>X</p>' }),
sAssertLastPostProcessEvent({ internal: true, content: '<p>X</p>' })
]);
};
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Log.stepsAsStep('TBA', 'Table: ul > li in table', [
tinyApis.sSetContent('<table><tbody><tr><td><ul><li>a</li><li>b</li></ul></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><ul><li>a<ul><li>b</li></ul></li></ul></td></tr></tbody>')
]),
Log.stepsAsStep('TBA', 'Table: ol > li in table', [
tinyApis.sSetContent('<table><tbody><tr><td><ol><li>a</li><li>b</li></ol></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><ol><li>a<ol><li>b</li></ol></li></ol></td></tr></tbody>')
]),
Log.stepsAsStep('TBA', 'Table: dl > dt in table', [
tinyApis.sSetContent('<table><tbody><tr><td><dl><dt>a</dt><dt>b</dt></dl></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><dl><dt>a</dt><dd>b</dd></dl></td></tr></tbody>')
])
], onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Table: no class input without setting', [
tinyApis.sFocus,
tinyApis.sSetContent(tableHtml),
tinyApis.sSetSelection([0, 0, 0, 0, 0], 0, [0, 0, 0, 0, 0], 1),
tinyApis.sExecCommand('mceTableCellProps'),
TableTestUtils.sAssertDialogPresence(
'Checking that class label is not present',
{
'label:contains("Class")': 0
}
),
TableTestUtils.sClickDialogButton('close', false),
tinyApis.sSetContent('')
]),
Log.stepsAsStep('TBA', 'Table: class input with setting', [
tinyApis.sFocus,
tinyApis.sSetSetting('table_cell_class_list', [{ title: 'test', value: 'test' }]),
tinyApis.sSetContent(tableHtml),
tinyApis.sSetSelection([0, 0, 0, 0, 0], 0, [0, 0, 0, 0, 0], 1),
tinyApis.sExecCommand('mceTableCellProps'),
TableTestUtils.sAssertSelectValue('Class select', 'Class', 'test'),
TableTestUtils.sClickDialogButton('Trigger test class', true),
tinyApis.sAssertContentPresence({ 'td.test': 1 })
])
], onSuccess, onFailure);
}, {
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
// var tinyActions = TinyActions(editor);
const steps = Utils.withTeardown([
Log.stepsAsStep('TBA', 'TextPattern: enter after first * in *a*', [
tinyApis.sSetContent('<p>*a*</p>'),
tinyApis.sFocus,
tinyApis.sSetCursor([0, 0], 1),
Step.sync(function () {
editor.fire('keydown', { keyCode: 13 });
}),
tinyApis.sAssertContent('<p>*</p><p>a*</p>')
]),
Log.stepsAsStep('TBA', 'TextPattern: enter after first * in *b*', [
tinyApis.sSetContent('<p><strong>a</strong>*b*</p>'),
tinyApis.sFocus,
tinyApis.sSetCursor([0, 1], 1),
Step.sync(function () {
editor.fire('keydown', { keyCode: 13 });
}),
tinyApis.sAssertContent('<p><strong>a</strong>*</p><p>b*</p>')
])
], tinyApis.sSetContent(''));
Pipeline.async({}, steps, onSuccess, onFailure);
}, {
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const dialogSelector = 'div.tox-dialog';
const docBody = Element.fromDom(document.body);
const editorBody = editor.contentDocument.body;
const markupContent = '<p>hello world</p>';
const tinyApis = TinyApis(editor);
Pipeline.async({},
[
Log.stepsAsStep('TBA', 'CodeSample: TBA-Open the dialog and check it has the right initial values. Set the codesample content, submit and check the editor content changes correctly. Double-click on the editor and check if the dialog opens with the correct language and content.', [
TestUtils.sOpenDialogAndAssertInitial(editor, docBody, 'markup', ''),
TestUtils.sSetTextareaContent(markupContent),
TestUtils.sSubmitDialog(docBody),
TestUtils.sAssertEditorContents(editorBody, 'markup', markupContent, 'pre.language-markup'),
Step.sync(function () {
const pre = editor.getBody().querySelector('pre');
editor.fire('dblclick', { target: pre });
}),
UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
TestUtils.sAssertCodeSampleDialog('markup', markupContent),
]),
Log.stepsAsStep('TBA', 'CodeSample: Selecting code sample should update button state', [
tinyApis.sSetContent('<p>abc</p><pre class="language-markup"><code></code></pre>'),
tinyApis.sSelect('p', []),
tinyApis.sNodeChanged,
UiFinder.sNotExists(docBody, 'button[aria-pressed="true"]'),
tinyApis.sSelect('pre.language-markup', []),
tinyApis.sNodeChanged,
UiFinder.sExists(docBody, 'button[aria-pressed="true"]'),
]),
]
, onSuccess, onFailure);
}, {
示例6: TinyApis
TinyLoader.setup((editor: Editor, onSuccess, onFailure) => {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Log.stepsAsStep('TBA', 'Text selection toolbar', [
tinyApis.sSetContent('<p>Some <strong>bold</strong> and <em>italic</em> content.</p><blockquote><p>Some quoted content</p></blockquote>'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 4),
sWaitForTextToolbarAndAssertState(tinyUi, false, false, false, false, false, false),
tinyApis.sSetSelection([0, 1, 0], 0, [0, 1, 0], 3),
sWaitForTextToolbarAndAssertState(tinyUi, true, false, false, false, false, false),
tinyApis.sSetSelection([0, 3, 0], 1, [0, 3, 0], 4),
sWaitForTextToolbarAndAssertState(tinyUi, false, true, false, false, false, false),
tinyApis.sSetSelection([1, 0], 0, [1, 0], 1),
sWaitForTextToolbarAndAssertState(tinyUi, false, false, false, false, false, true)
]),
Log.stepsAsStep('TBA', 'Image selection toolbar', [
sSetImageAndAssertToolbarState(tinyApis, tinyUi, false),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, false, Alignment.Left),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, false, Alignment.Center),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, false, Alignment.Right),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, true),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, true, Alignment.Left),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, true, Alignment.Center),
sSetImageAndAssertToolbarState(tinyApis, tinyUi, true, Alignment.Right)
])
], onSuccess, onFailure);
}, {
示例7: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, browser.isIE() ? [] : [
Log.stepsAsStep('TBA', 'TextColor: forecolor', [
tinyApis.sFocus,
tinyApis.sSetContent('hello test'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 5),
tinyUi.sClickOnToolbar('click forecolor', '[aria-label="Text color"] > .tox-tbtn + .tox-split-button__chevron'),
tinyUi.sWaitForUi('wait for color swatch to open', '.tox-swatches'),
tinyUi.sClickOnUi('click green color', 'div[data-mce-color="#18A085"]'),
tinyUi.sClickOnToolbar('click forecolor again', '[aria-label="Text color"] > .tox-tbtn + .tox-split-button__chevron'),
tinyUi.sWaitForUi('wait for color swatch to open', '.tox-swatches'),
tinyUi.sClickOnUi('click blue color', 'div[data-mce-color="#2B3E50"]'),
tinyApis.sAssertContentStructure(forecolorStruct)
]),
Log.stepsAsStep('TBA', 'TextColor: backcolor', [
tinyApis.sFocus,
tinyApis.sSetContent('hello test'),
tinyApis.sSetSelection([0, 0], 0, [0, 0], 5),
tinyUi.sClickOnToolbar('click backcolor', '[aria-label="Background color"] > .tox-tbtn + .tox-split-button__chevron'),
tinyUi.sWaitForUi('wait for color swatch to open', '.tox-swatches'),
tinyUi.sClickOnUi('click green color', 'div[data-mce-color="#18A085"]'),
tinyUi.sClickOnToolbar('click backcolor again', '[aria-label="Background color"] > .tox-tbtn + .tox-split-button__chevron'),
tinyUi.sWaitForUi('wait for color swatch to open', '.tox-swatches'),
tinyUi.sClickOnUi('click a nice purple color', 'div[data-mce-color="#2B3E50"]'),
tinyApis.sAssertContentStructure(backcolorStruct)
])
], onSuccess, onFailure);
}, {
示例8: sSetProgressState
TinyLoader.setup((editor, onSuccess, onFailure) => {
const sSetProgressState = (state: boolean, time?: number) => Step.sync(() => {
if (state) {
editor.setProgressState(true, time);
} else {
editor.setProgressState(false);
}
});
Pipeline.async({}, [
Log.stepsAsStep('TBA', 'Throbber actions test', [
sAssertThrobberHiddenStructure,
sSetProgressState(true),
UiFinder.sWaitForVisible('Wait for throbber to show', Body.body(), '.tox-throbber'),
sAssertThrobberShownStructure,
sSetProgressState(false),
UiFinder.sWaitForHidden('Wait for throbber to hide', Body.body(), '.tox-throbber'),
sAssertThrobberHiddenStructure
]),
Log.stepsAsStep('TBA', 'Throbber actions with timeout test', [
sSetProgressState(true, 300),
// Wait for a little and make sure the throbber is still hidden
Step.wait(150),
sAssertThrobberHiddenStructure,
UiFinder.sWaitForVisible('Wait for throbber to show', Body.body(), '.tox-throbber'),
sAssertThrobberShownStructure,
sSetProgressState(false),
UiFinder.sWaitForHidden('Wait for throbber to hide', Body.body(), '.tox-throbber'),
sAssertThrobberHiddenStructure
])
], onSuccess, onFailure);
}, {
示例9: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
const steps = Utils.withTeardown(
[
Log.stepsAsStep('TBA', 'TextPattern: inline italic then undo', [
Utils.sSetContentAndPressSpace(tinyApis, tinyActions, '*a*'),
tinyApis.sAssertContentStructure(Utils.inlineStructHelper('em', 'a')),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a* </p>')
]),
Log.stepsAsStep('TBA', 'TextPattern: block italic then undo', [
Utils.sSetContentAndPressEnter(tinyApis, tinyActions, '*a*'),
tinyApis.sAssertContentStructure(Utils.inlineBlockStructHelper('em', 'a')),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a*</p>\n<p> </p>'),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a*</p>'),
]),
],
tinyApis.sSetContent('')
);
Pipeline.async({}, steps, onSuccess, onFailure);
}, {