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


TypeScript ApproxStructure.build方法代碼示例

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


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

示例1: function

 const sTestEnterAtStartOfAnchorZwsp = function (tinyApis, tinyActions) {
   return Logger.t(
     'sTestEnterAtStartOfAnchorZwsp',
     GeneralSteps.sequence([
       sSetup(tinyApis, '<p><a href="#">' + Zwsp.ZWSP + 'a</a></p>', [0, 0, 0], 1),
       sEnterKey(tinyActions),
       tinyApis.sAssertContentStructure(
         ApproxStructure.build(function (s, str, arr) {
           return s.element('body', {
             children: [
               s.element('p', {
                 children: [
                   s.element('br', {
                     attrs: {
                       'data-mce-bogus': str.is('1')
                     }
                   })
                 ]
               }),
               s.element('p', {
                 children: addGeckoBr(s, str, [
                   s.element('a', {
                     attrs: {
                       'data-mce-href': str.is('#'),
                       'href': str.is('#')
                     },
                     children: [
                       s.text(str.is(Zwsp.ZWSP + 'a'))
                     ]
                   })
                 ])
               })
             ]
           });
         })
       ),
       tinyApis.sAssertSelection([1, 0, 0], 1, [1, 0, 0], 1)
     ])
   );
 };
開發者ID:abstask,項目名稱:tinymce,代碼行數:40,代碼來源:EnterKeyAnchorTest.ts

示例2:

  const sAssertInitialIframeStructure = (component: AlloyComponent) => {
    return Assertions.sAssertStructure(
      'Checking initial structure',
      ApproxStructure.build((s, str, arr) => {
        const labelStructure = s.element('label', {
          classes: [ arr.has('tox-label') ],
          html: str.is('iframe label')
        });

        const iframeStructure = s.element('div', {
          classes: [ arr.has('tox-navobj') ],
          children: [
            s.element('div', {
              attrs: {
                'data-alloy-tabstop': str.is('true')
              }
            }),
            s.element('iframe', {
              classes: [ ],
              attrs: {
                // Should be no source.
                src: str.none()
              }
            }),
            s.element('div', {
              attrs: {
                'data-alloy-tabstop': str.is('true')
              }
            })
          ]
        });

        return s.element('div', {
          classes: [ arr.has('tox-form__group') ],
          children: [ labelStructure, iframeStructure ]
        });
      }),
      component.element()
    );
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:40,代碼來源:IframeTest.ts

示例3:

    (doc, body, gui, component, store) => {

      return [
        Assertions.sAssertStructure(
          'Checking initial structure',
          ApproxStructure.build((s, str, arr) => {
            return s.element('div', {
              classes: [ arr.has('tox-form__group') ],
              children: [
                s.element('label', {
                  classes: [ arr.has('tox-label') ]
                }),
                s.element('div', {
                  classes: [arr.has('tox-selectfield')],
                  children: [
                    s.element('select', {
                      attrs: {
                        size: str.is('5')
                      },
                      children: [
                        s.element('option', { value: str.is('one'), html: str.is('One') }),
                        s.element('option', { value: str.is('two'), html: str.is('Two') }),
                        s.element('option', { value: str.is('three'), html: str.is('Three')}),
                        s.element('option', { value: str.is('four'), html: str.is('Four') }),
                        s.element('option', { value: str.is('five'), html: str.is('Five') })
                      ]
                    })
                  ]
                })
              ]
            });
          }),
          component.element()
        ),

        RepresentingSteps.sSetValue('Choosing three', component, 'three'),
        DomSteps.sAssertValue('After setting "three"', 'three', component, 'select'),
        RepresentingSteps.sAssertComposedValue('Checking is three', 'three', component)
      ];
    },
開發者ID:tinymce,項目名稱:tinymce,代碼行數:40,代碼來源:SelectboxWithSizeTest.ts

示例4: TinyApis

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

    Pipeline.async({}, [
      tinyApis.sSetContent('[b]a[/b]'),
      tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
        return s.element('body', {
          children: [
            s.element('p', {
              children: [
                s.element('strong', {
                  children: [
                    s.text(str.is('a'))
                  ]
                })
              ]
            })
          ]
        });
      }))
    ], onSuccess, onFailure);
  }, {
開發者ID:abstask,項目名稱:tinymce,代碼行數:22,代碼來源:BbcodeSanityTest.ts

示例5: TinyApis

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

    Pipeline.async({}, Log.steps('TBA', 'BBCode: Set bbcode content and assert the equivalent html structure is present', [
      tinyApis.sSetContent('[b]a[/b]'),
      tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
        return s.element('body', {
          children: [
            s.element('p', {
              children: [
                s.element('strong', {
                  children: [
                    s.text(str.is('a'))
                  ]
                })
              ]
            })
          ]
        });
      }))
    ]), onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:22,代碼來源:BbcodeSanityTest.ts

示例6: TinyUi

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

      Pipeline.async({},
        Log.steps('TBA', 'InsertDateTime: Click on Insertdatetime button and select the first item from the drop down menu. Assert date time is inserted', [
          tinyUi.sClickOnToolbar('click on insertdatetime button', '[aria-haspopup="true"]'),
          tinyUi.sWaitForUi('wait for menu', '[role="menu"]'),
          tinyUi.sClickOnUi('click on first in menu', '[role="menu"] [role="menuitemcheckbox"]:first'),
          tinyApis.sAssertContentStructure(ApproxStructure.build(function (s) {
            return s.element('body', {
              children: [
                s.element('p', {
                  children: [
                    s.element('time', {})
                  ]
                })
              ]
            });
          }))
        ])
      , onSuccess, onFailure);
    }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:23,代碼來源:InsertDatetimeSanityTest.ts

示例7: TinyUi

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

    Pipeline.async({}, Log.steps('TBA', 'PageBreak: Click on the pagebreak toolbar button and assert pagebreak is inserted', [
      tinyUi.sClickOnToolbar('click on pagebreak button', 'button[aria-label="Page break"]'),
      tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str, arr) {
        return s.element('body', {
          children: [
            s.element('p', {
              children: [
                s.element('img', {
                  classes: [
                    arr.has('mce-pagebreak')
                  ]
                })
              ]
            })
          ]
        });
      }))
    ]), onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:23,代碼來源:PageBreakSanityTest.ts

示例8:

const sAssertEditorContentStructure = (editorBody, language, content) => {
  return Logger.t('Assert editor contents structure', Waiter.sTryUntil(
    'Assert content',
    Assertions.sAssertStructure(
      'Asserting editor structure',
      ApproxStructure.build((s, str, arr) => {
      return s.element('body', {
        children: [
          s.element('pre', {
            classes: [
              arr.has('language-' + language)
            ],
            attrs: {
              contenteditable: str.is('false')
            }
          }),
          s.anything()
        ]
      });
    }),
    Element.fromDom(editorBody)
  ), 100, 3000));
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:23,代碼來源:CodeSampleTestUtils.ts

示例9: function

 const sTestEnterAtEndOfAnchorZwspWithAdjacentContent = function (tinyApis, tinyActions) {
   return Logger.t(
     'sTestEnterAtStartOfAnchorZwspWithAdjacentContent',
     GeneralSteps.sequence([
       sSetup(tinyApis, '<p>a<a href="#">b' + Zwsp.ZWSP + '</a>c</p>', [0, 1, 0], 1),
       sEnterKey(tinyActions),
       tinyApis.sAssertContentStructure(
         ApproxStructure.build(function (s, str, arr) {
           return s.element('body', {
             children: [
               s.element('p', {
                 children: [
                   s.text(str.is('a')),
                   s.element('a', {
                     attrs: {
                       'data-mce-href': str.is('#'),
                       'href': str.is('#')
                     },
                     children: [
                       s.text(str.is('b'))
                     ]
                   })
                 ]
               }),
               s.element('p', {
                 children: [
                   s.text(str.is('c'))
                 ]
               })
             ]
           });
         })
       ),
       tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
     ])
   );
 };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:37,代碼來源:EnterKeyAnchorTest.ts

示例10: TinyUi

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

    Pipeline.async({}, [
      tinyUi.sClickOnToolbar('click on emoticons button', 'div[aria-label="Emoticons"] > button'),
      tinyUi.sClickOnUi('click on kiss', 'a[aria-label="kiss"]'),
      tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
        return s.element('body', {
          children: [
            s.element('p', {
              children: [
                s.element('img', {
                  attrs: {
                    alt: str.is('kiss')
                  }
                })
              ]
            })
          ]
        });
      }))
    ], onSuccess, onFailure);
  }, {
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:24,代碼來源:EmoticonSanityTest.ts


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