當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Log.step方法代碼示例

本文整理匯總了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);
});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:58,代碼來源:InitContentBodyDirectionalityTest.ts

示例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);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:PrintSanityTest.ts

示例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);
 }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:FullscreenPluginInlineEditorTest.ts

示例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
     }
   ])
 );
開發者ID:tinymce,項目名稱:tinymce,代碼行數:9,代碼來源:DialogSectionsTest.ts

示例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);
  }, {
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:21,代碼來源:InitEditorPluginInitErrorTest.ts

示例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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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);
    }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:22,代碼來源:NonbreakingForceTabTest.ts

示例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',
//.........這裏部分代碼省略.........
開發者ID:tinymce,項目名稱:tinymce,代碼行數:101,代碼來源:DialogFlowTest.ts

示例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(''))
   ])
 );
開發者ID:tinymce,項目名稱:tinymce,代碼行數:13,代碼來源:ImageToolsErrorTest.ts

示例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(
        {
//.........這裏部分代碼省略.........
開發者ID:tinymce,項目名稱:tinymce,代碼行數:101,代碼來源:ImportCssGroupsPluginTest.ts


注:本文中的@ephox/agar.Log.step方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。