当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Assertions.cAssertStructure方法代码示例

本文整理汇总了TypeScript中@ephox/agar.Assertions.cAssertStructure方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Assertions.cAssertStructure方法的具体用法?TypeScript Assertions.cAssertStructure怎么用?TypeScript Assertions.cAssertStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/agar.Assertions的用法示例。


在下文中一共展示了Assertions.cAssertStructure方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: insertTablePickerApprox

    (editor, onSuccess, onFailure) => {
      const doc = Element.fromDom(document);

      Pipeline.async({ }, Log.steps(
        'TBA',
        'Check structure of table picker',
        [
          Mouse.sClickOn(Body.body(), '.tox-toolbar button'),
          UiFinder.sWaitForVisible('Waiting for menu', Body.body(), '[role="menu"]'),
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('[role="menu"]'),
            Assertions.cAssertStructure(
              'Checking structure',
              ApproxStructure.build((s, str, arr) => insertTablePickerApprox(s, str, arr, 1, 1))
            )
          ]),
          FocusTools.sTryOnSelector('Focus should be on first table cell', doc, '.tox-insert-table-picker__selected:last'),
          Keyboard.sKeydown(doc, Keys.down(), {}),
          Keyboard.sKeydown(doc, Keys.right(), {}),
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('[role="menu"]'),
            Assertions.cAssertStructure(
              'Checking structure',
              ApproxStructure.build((s, str, arr) => insertTablePickerApprox(s, str, arr, 2, 2))
            )
          ]),
          FocusTools.sTryOnSelector('Focus should be on 2 down, 2 across table cell', doc, '.tox-insert-table-picker__selected:last')
        ]
      ), onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:30,代码来源:OxideTablePickerMenuTest.ts

示例2:

 const sAssertMenuItemGroups = (label: string, groups: string[][]) => Logger.t(
   label,
   Chain.asStep(sink, [
     UiFinder.cFindIn('.tox-selected-menu'),
     Assertions.cAssertStructure(
       'Checking contents of menu',
       ApproxStructure.build((s, str, arr) => {
         return s.element('div', {
           children: Arr.map(groups, (items) => {
             return s.element('div', {
               classes: [ arr.has('tox-collection__group') ],
               children: Arr.map(items, (itemText) => {
                 // itemText can have a trailing >, which means it has a caret
                 const hasCaret = Strings.endsWith(itemText, '>');
                 return s.element('div', {
                   classes: [ arr.has('tox-collection__item') ],
                   children: [
                     s.element('div', { classes: [ arr.has('tox-collection__item-icon') ] }),
                     s.element('div', {
                       classes: [ arr.has('tox-collection__item-label') ],
                       html: str.is(hasCaret ? itemText.substring(0, itemText.length - 1) : itemText)
                     })
                   ].concat(hasCaret ? [
                     s.element('div', { classes: [ arr.has('tox-collection__item-caret') ] })
                   ] : [ ])
                 });
               })
             });
           })
         });
       })
     )
   ])
 );
开发者ID:tinymce,项目名称:tinymce,代码行数:34,代码来源:SilverMenubarTest.ts

示例3:

 const sAssertMenu = (label: string, expected, hasIcons) => {
   return Chain.asStep(Body.body(), [
     UiFinder.cWaitForVisible('Waiting for styles menu to appear', '[role="menu"]'),
     Assertions.cAssertStructure('Checking structure', ApproxStructure.build((s, str, arr) => {
       return s.element('div', {
         classes: [ arr.has('tox-menu') ],
         children: [
           s.element('div', {
             classes: [ arr.has('tox-collection__group') ],
             children: Arr.map(expected, (exp) => {
               return s.element('div', {
                 classes: [ arr.has('tox-collection__item') ],
                 children: [
                   ...hasIcons ? [ s.element('div', { classes: [ arr.has('tox-collection__item-icon') ]}) ] : [ ],
                   s.element('div', exp.submenu ? {
                     classes: [ arr.has('tox-collection__item-label') ],
                     html: str.is(exp.html)
                   } : {
                     classes: [ arr.has('tox-collection__item-label') ],
                     children: [
                       s.element(exp.tag, { html: str.is(exp.html) })
                     ]
                   })
                 ].concat(exp.submenu ? [ s.anything() ] : [ ])
               });
             })
           })
         ]
       });
     }))
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:32,代码来源:ImportCssPluginTest.ts

示例4: structWithTitleAndIconAndText

 const sAssertAutocompleterStructure = (structure: AutocompleterStructure) => {
   return Chain.asStep(Body.body(), [
     UiFinder.cFindIn('.tox-autocompleter'),
     Assertions.cAssertStructure(
       'Checking the autocompleter',
       ApproxStructure.build((s, str, arr) => {
         return s.element('div', {
           classes: [ arr.has('tox-autocompleter') ],
           children: [
             s.element('div', {
               classes: [ arr.has('tox-menu'), arr.has(`tox-collection--${structure.type}`), arr.has('tox-collection') ],
               children: Arr.map(structure.groups, (group) => {
                 return s.element('div', {
                   classes: [ arr.has('tox-collection__group') ],
                   children: Arr.map(group, (d) => {
                     if (structure.type === 'list') {
                       if (structure.hasIcons) {
                         return structWithTitleAndIconAndText(d)(s, str, arr);
                       } else {
                         return structWithTitleAndText(d)(s, str, arr);
                       }
                     } else {
                       return structWithTitleAndIcon(d)(s, str, arr);
                     }
                   })
                 });
               })
             })
           ]
         });
       })
     )
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:34,代码来源:AutocompleterTest.ts

示例5: rgb

    (editor, onSuccess, onFailure) => {
      const doc = Element.fromDom(document);

      Pipeline.async({ }, Logger.ts(
        'Check structure of grid collection menu',
        [
          TestHelpers.GuiSetup.mAddStyles(doc, [
            ':focus { background-color: rgb(222, 224, 226); }'
          ]),
          Mouse.sClickOn(Body.body(), '.tox-split-button__chevron'),
          UiFinder.sWaitForVisible('Waiting for menu', Body.body(), '[role="menu"]'),
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('[role="menu"]'),
            Assertions.cAssertStructure(
              'Checking structure',
              ApproxStructure.build((s, str, arr) => {
                return s.element('div', {
                  classes: [ arr.has('tox-menu'), arr.has('tox-collection'), arr.has('tox-collection--grid') ],
                  children: [
                    s.element('div', {
                      classes: [ arr.has('tox-collection__group') ],
                      children: Arr.map([ '1', '2', '3', '4', '5', '6', '7', '8' ], (num) => {
                        return s.element('div', {
                          classes: [ arr.has('tox-collection__item') ],
                          attrs: {
                            title: str.is(num)
                          },
                          children: [
                            // NOTE: The oxide demo page has div, but I think that's just a mistake
                            s.element('div', {
                             classes: [ arr.has('tox-collection__item-icon') ],
                             children: [
                               s.element('svg', {})
                             ]
                            })
                          ]
                        });
                      })
                    })
                  ]
                });
              })
            )
          ]),

          // Without layout, the flatgrid cannot be calculated on phantom
          navigator.userAgent.indexOf('PhantomJS') > -1 ? Step.pass : GeneralSteps.sequence([
            FocusTools.sTryOnSelector('Focus should be on 1', doc, '.tox-collection__item[title="1"]'),
            Keyboard.sKeydown(doc, Keys.right(), { }),
            FocusTools.sTryOnSelector('Focus should be on 2', doc, '.tox-collection__item[title="2"]'),
            Keyboard.sKeydown(doc, Keys.right(), { }),
            FocusTools.sTryOnSelector('Focus should be on 3', doc, '.tox-collection__item[title="3"]')
          ]),
          TestHelpers.GuiSetup.mRemoveStyles
        ]
      ), onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:57,代码来源:OxideGridCollectionMenuTest.ts

示例6: children

 const sCheckLastButtonGroup = (label: string, children: (s, str, arr) => any) => {
   return Chain.asStep(Body.body(), [
     UiFinder.cFindIn('.tox-pop .tox-toolbar__group:last'),
     Assertions.cAssertStructure(label, ApproxStructure.build((s, str, arr) => {
       return s.element('div', {
         children: children(s, str, arr)
       });
     }))
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:ContextFormTest.ts

示例7: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyUi = TinyUi(editor);
    const doc = Element.fromDom(document);
    const body = Body.body();

    Pipeline.async({},
      Log.steps('TBA', 'Emoticons: Open dialog, verify custom categories listed and search for custom emoticon', [
        tinyApis.sFocus,
        tinyUi.sClickOnToolbar('click emoticons', 'button'),
        Chain.asStep({}, [
          tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
        ]),
        FocusTools.sTryOnSelector('Focus should start on input', doc, 'input'),
        Chain.asStep(body, [
          UiFinder.cFindIn('[role="tablist"]'),
          Assertions.cAssertStructure('check custom categories are shown', ApproxStructure.build((s, str, arr) => {
            return s.element('div', {
              children: [
                tabElement(s, str, arr)('All'),
                tabElement(s, str, arr)('People'),
                tabElement(s, str, arr)('User Defined')
              ]
            });
          })),
        ]),
        FocusTools.sSetActiveValue(doc, 'clock'),
        Chain.asStep(doc, [
          FocusTools.cGetFocused,
          cFakeEvent('input')
        ]),
        Waiter.sTryUntil(
          'Wait until clock is the first choice (search should filter)',
          Chain.asStep(body, [
            UiFinder.cFindIn('.tox-collection__item:first'),
            Chain.mapper((item) => {
              return Attr.get(item, 'data-collection-item-value');
            }),
            Assertions.cAssertEq('Search should show custom clock', '⏲')
          ]),
          100,
          1000
        ),
        Keyboard.sKeydown(doc, Keys.tab(), {}),
        FocusTools.sTryOnSelector('Focus should have moved to collection', doc, '.tox-collection__item'),
        Keyboard.sKeydown(doc, Keys.enter(), {}),
        Waiter.sTryUntil(
          'Waiting for content update',
          tinyApis.sAssertContent('<p>⏲</p>'),
          100,
          1000
        )
      ])
      , onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:55,代码来源:EmoticonAppendTest.ts

示例8: Theme

UnitTest.asynctest('Editor alignment toolbar buttons test', (success, failure) => {
  Theme();

  Pipeline.async({}, [
    Log.chainsAsStep('TBA', 'Testing toolbar: toolbar alignment buttons', [
      NamedChain.asChain([
        NamedChain.writeValue('body', Body.body()),
        NamedChain.write('editor', McEditor.cFromSettings({
          toolbar: 'alignleft aligncenter alignright alignjustify alignnone',
          theme: 'silver',
          base_url: '/project/tinymce/js/tinymce'
        })),
        NamedChain.direct('body', UiFinder.cWaitForVisible('Waiting for menubar', '.tox-menubar'), '_menubar'),
        NamedChain.direct('body', cExtractOnlyOne('.tox-toolbar'), 'toolbar'),
        NamedChain.direct('toolbar', Assertions.cAssertStructure(
          'Checking toolbar should have just alignment buttons',
          ApproxStructure.build((s, str, arr) => {
            return s.element('div', {
              classes: [ arr.has('tox-toolbar') ],
              children: [
                s.element('div', {
                  classes: [ arr.has('tox-toolbar__group') ],
                  children: [
                    s.element('button', {
                      attrs: { title: str.is('Align left')}
                    }),
                    s.element('button', {
                      attrs: { title: str.is('Align center')}
                    }),
                    s.element('button', {
                      attrs: { title: str.is('Align right')}
                    }),
                    s.element('button', {
                      attrs: { title: str.is('Justify')}
                    }),
                    s.element('button', {
                      attrs: { title: str.is('No alignment')}
                    }),
                  ]
                })
              ]
            });
          })
        ), Id.generate('')),
        NamedChain.direct('editor', McEditor.cRemove, Id.generate('')),
        NamedChain.bundle(Result.value)
      ])
    ])
  ], success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:50,代码来源:AlignmentButtonsTest.ts

示例9:

 const sHasDialog = (label: string) => Chain.asStep(Body.body(), [
   UiFinder.cFindIn('.tox-pop'),
   Assertions.cAssertStructure(
     `${label}: Checking pop has a dialog`,
     ApproxStructure.build((s, str, arr) => {
       return s.element('div', {
         classes: [ arr.has('tox-pop') ],
         children: [
           s.element('div', {
             classes: [ arr.has('tox-pop__dialog') ]
           })
         ]
       });
     })
   )
 ]);
开发者ID:tinymce,项目名称:tinymce,代码行数:16,代码来源:ContextFormTest.ts

示例10: cSetContent

 const makeStep = (config, label, editorStructure) => {
   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', cGetEditorContainer, 'editorContainer'),
       NamedChain.direct('editorContainer', Assertions.cAssertStructure(
         label,
         editorStructure
       ), 'assertion'),
       NamedChain.output('editor')
     ]),
     McEditor.cRemove
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:16,代码来源:SilverEditorDirectionalityTest.ts


注:本文中的@ephox/agar.Assertions.cAssertStructure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。