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


TypeScript Chain.fromChains方法代碼示例

本文整理匯總了TypeScript中@ephox/agar.Chain.fromChains方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Chain.fromChains方法的具體用法?TypeScript Chain.fromChains怎麽用?TypeScript Chain.fromChains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/agar.Chain的用法示例。


在下文中一共展示了Chain.fromChains方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: TinyUi

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyUi = TinyUi(editor);

    Pipeline.async({}, [
      Logger.t('insert url by typing', GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('click on link button', 'button[aria-label="Insert/edit link"]'),
        Chain.asStep({}, [
          Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
            [
              Chain.fromChains([
                cFindByLabelFor('URL'),
                UiControls.cSetValue('http://www.test.com/'),
                cFakeEvent('input')
              ]),
              Chain.fromChains([
                cFindByLabelFor('Text to display'),
                UiControls.cGetValue,
                Assertions.cAssertEq('should be the same url', 'http://www.test.com/')
              ]),
              cCloseDialog
            ]
          )
        ])

      ]))
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:27,代碼來源:UrlInputTest.ts

示例2: TinyUi

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyUi = TinyUi(editor);
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      Log.stepsAsStep('TBA', 'Media: test cached response', [
        tinyUi.sClickOnToolbar('click media button', 'button[aria-label="Insert/edit media"]'),
        Chain.asStep({}, [
          Chain.fromParent(
            tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'test'),
                Utils.cFakeEvent('paste'),
                Chain.wait(0) // wait is needed because paste is triggered async
              ]),
              Chain.runStepsOnValue(() => [ Utils.sAssertEmbedData(tinyUi, '<div>x</div>') ]),
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'XXX')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn(Utils.selectors.saveButton),
                Mouse.cClick
              ])
            ]
          )
        ]),

        sWaitForAndAssertNotification('<p>Media embed handler threw unknown error.</p>'),
        tinyApis.sAssertContent('')
      ])
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:33,代碼來源:IsCachedResponseTest.ts

示例3: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      tinyApis.sSetContent('<p>abc 123</p>'),
      tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
      tinyActions.sContentKeystroke(Keys.space(), {}),
      tinyApis.sExecCommand('mceanchor'),
      Chain.asStep(Element.fromDom(document.body), [
        Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[aria-label="Anchor"][role="dialog"]'),
          [
            Chain.fromChains([
              UiFinder.cFindIn('input'),
              UiControls.cSetValue('abc')
            ]),
            Chain.fromChains([
              UiFinder.cFindIn('button:contains("Ok")'),
              Mouse.cClick
            ])
          ]
        )
      ]),
      tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')

    ], onSuccess, onFailure);
  }, {
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:28,代碼來源:AnchorInlineTest.ts

示例4: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);

    Pipeline.async({},
      Log.steps('TBA', 'Anchor: Add anchor by selecting text content, then check that anchor is inserted correctly', [
        tinyApis.sFocus,
        tinyApis.sSetContent('<p>abc 123</p>'),
        tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
        tinyActions.sContentKeystroke(Keys.space(), {}),
        tinyApis.sExecCommand('mceanchor'),
        Chain.asStep(Element.fromDom(document.body), [
          Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[role="dialog"].tox-dialog'),
            [
              Chain.fromChains([
                UiFinder.cFindIn('input'),
                UiControls.cSetValue('abc')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn('button:contains("Save")'),
                Mouse.cClick
              ])
            ]
          )
        ]),
        tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')
    ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:29,代碼來源:AnchorInlineTest.ts

示例5: TinyUi

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyUi = TinyUi(editor);
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      Logger.t('test cached response', GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('click media button', 'div[aria-label="Insert/edit media"] > button'),
        Chain.asStep({}, [
          Chain.fromParent(
            tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'test'),
                Utils.cFakeEvent('paste')
              ]),
              Chain.fromChains([
                cAssertEmbedValue('<div>x</div>')
              ]),
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'XXX')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn('button:contains("Ok")'),
                Mouse.cClick
              ])
            ])
        ]),
        sWaitForAndAssertNotification('Media embed handler threw unknown error.'),
        tinyApis.sAssertContent('')
      ]))
    ], onSuccess, onFailure);
  }, {
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:32,代碼來源:IsCachedResponseTest.ts

示例6: Plugin

UnitTest.asynctest('browser.tinymce.plugins.media.NoAdvancedTabTest', (success, failure) => {
  Plugin();
  Theme();

  Pipeline.async({}, [
    Log.chainsAsStep('TBA', 'Media: if alt source and poster set to false, do not show advance tab', [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          media_alt_source: false,
          media_poster: false,
          theme: 'silver',
          base_url: '/project/tinymce/js/tinymce'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
            Utils.cNotExists('div.tox-tab:contains(Advanced)')
          ]),
          Editor.cRemove
        ]
      )
    ]),
    Log.chainsAsStep('TBA', 'Media: if alt source and poster not set to false, show advance tab', [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          theme: 'silver',
          base_url: '/project/tinymce/js/tinymce'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
            Utils.cExists('div.tox-tab:contains(Advanced)')
          ]),
          Editor.cRemove
        ]
      )
    ])
  ], () => success(), failure);

});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:48,代碼來源:NoAdvancedTabTest.ts

示例7: from

 const cResizeToPos = (sx: number, sy: number, dx: number, dy: number, delta: number = 10) => {
   // Simulate moving the mouse, by making a number of movements
   const numMoves = sy === dy ? Math.abs(dx - sx) / delta : Math.abs(dy - sy) / delta;
   // Determine the deltas based on the number of moves to make
   const deltaX = (dx - sx) / numMoves;
   const deltaY = (dy - sy) / numMoves;
   // Move and release the mouse
   return Chain.control(
     Chain.fromChains([
         UiFinder.cFindIn('.tox-blocker'),
         Mouse.cMouseMoveTo(sx, sy)
       ].concat(
         Arr.range(numMoves, (count) => {
           const nx = sx + count * deltaX;
           const ny = sy + count * deltaY;
           return Mouse.cMouseMoveTo(nx, ny);
         })
       ).concat([
         Mouse.cMouseMoveTo(dx, dy),
         Mouse.cMouseUp
       ])
     ),
     Guard.addLogging(`Resizing from (${sx}, ${sy}) to (${dx}, ${dy})`)
   );
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:25,代碼來源:ResizeTest.ts

示例8: function

 const sDragDropBlocker = function (container, selector, dx, dy) {
   return Chain.asStep({}, [
     Chain.fromParent(Chain.inject(container), [
       Chain.fromChains([
         UiFinder.cFindIn(selector),
         Mouse.cMouseDown
       ]),
       Chain.fromChains([
         UiFinder.cFindIn('div.ephox-dragster-blocker'),
         Mouse.cMouseMove,
         Mouse.cMouseMoveTo(dx, dy),
         Mouse.cMouseUpTo(dx, dy)
       ])
     ])
   ]);
 };
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:16,代碼來源:DragResizeTest.ts

示例9:

 const sDragDropBlocker = (container, selector, dx, dy) => {
   return Logger.t('Block dragging and dropping of any other element in the container', Chain.asStep({}, [
     Chain.fromParent(Chain.inject(container), [
       Chain.fromChains([
         UiFinder.cFindIn(selector),
         Mouse.cMouseDown
       ]),
       Chain.fromChains([
         UiFinder.cFindIn('div.ephox-dragster-blocker'),
         Mouse.cMouseMove,
         Mouse.cMouseMoveTo(dx, dy),
         Mouse.cMouseUpTo(dx, dy)
       ])
     ])
   ]));
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:16,代碼來源:DragResizeTest.ts

示例10:

const cSetInputValue = (section, newValue) =>  Chain.control(
  Chain.fromChains([
    UiFinder.cFindIn(`label:contains(${section}) + div > input`),
    UiControls.cSetValue(newValue)
  ]),
  Guard.addLogging('Set input value' + newValue)
);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:TableTestUtils.ts


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