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


TypeScript Assertions.assertStructure方法代码示例

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


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

示例1: getSkinCssFilenames

  const mAssertEditors = Step.label('mAssertEditors', Step.stateful(function (editors: any[], next, die) {
    Assertions.assertHtml('Editor contents should be the first div content', '<p>a</p>', editors[0].getContent());
    Assertions.assertHtml('Editor contents should be the second div content', '<p>b</p>', editors[1].getContent());
    console.log('Editor container 0:', editors[0].editorContainer);
    const containerApproxStructure = ApproxStructure.build((s, str, arr) => {
      return s.element('div', {
        classes: [ arr.has('tox'), arr.has('tox-tinymce'), arr.has('tox-tinymce-inline') ],
        children: [
          s.element('div', {
            classes: [ arr.has('tox-editor-container') ],
            children: [
              s.element('div', {
                classes: [ arr.has('tox-menubar') ],
                attrs: {
                  role: str.is('menubar'),
                },
              }),
              s.element('div', {
                classes: [ arr.has('tox-toolbar') ],
                attrs: {
                  role: str.is('group'),
                },
              }),
              s.element('div', {
                classes: [ arr.has('tox-anchorbar') ]
              })
            ]
          }),
          s.element('div', {
            classes: [ arr.has('tox-throbber') ]
          })
        ]
      });
    });
    Assertions.assertStructure('Editor container should match expected structure', containerApproxStructure, Element.fromDom(editors[0].editorContainer));
    Assertions.assertStructure('Editor container should match expected structure', containerApproxStructure, Element.fromDom(editors[1].editorContainer));

    Assertions.assertEq(
      'Should only be two skin files the skin and the content for inline mode',
      ['skin.min.css', 'content.inline.min.css'],
      getSkinCssFilenames()
    );

    const targets = Arr.map(editors, function (editor) {
      return editor.getElement();
    });

    Assertions.assertEq('Targets should be two since there are two editors', 2, targets.length);

    next(targets);
  }));
开发者ID:tinymce,项目名称:tinymce,代码行数:51,代码来源:EditorInitializationTest.ts

示例2:

 Chain.op((urlinput) => {
   Assertions.assertStructure(
     'Checking content of url input',
     ApproxStructure.build(expected),
     urlinput
   );
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:DialogFlowTest.ts

示例3:

  return Logger.t('Assert HTML structure of the element ' + expected, Step.sync(() => {
    const body = editor.getBody();
    body.normalize(); // consolidate text nodes

    Assertions.assertStructure(
      'Asserting HTML structure of the element: ' + selector,
      expected,
      SelectorFind.descendant(Element.fromDom(body), selector).getOrDie('Nothing in the Editor matches selector: ' + selector)
    );
  }));
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:TableTestUtils.ts

示例4:

    return Step.sync(function () {
      const rawBody = editor.getBody().cloneNode(true);
      rawBody.normalize();

      Assertions.assertStructure(
        'Asserting the normalized structure of tiny content.',
        expected,
        Element.fromDom(rawBody)
      );
    });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:CaretFormatTest.ts

示例5:

      return Step.sync(function () {
        const body = editor.getBody();
        body.normalize(); // consolidate text nodes

        Assertions.assertStructure(
          'Asserting HTML structure of the element: ' + selector,
          ApproxStructure.fromHtml(expected),
          SelectorFind.descendant(Element.fromDom(body), selector).getOrDie('Nothing in the Editor matches selector: ' + selector)
        );
      });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:10,代码来源:TableDialogTest.ts

示例6:

 Chain.op((input) =>
   Assertions.assertStructure('should have all attributes', ApproxStructure.build((s, str, arr) => {
     return s.element('iframe', {
       attrs: {
         width: str.is('300'),
         height: str.is('150')
       },
       styles: {
         width: str.none('should not have width style'),
         height: str.none('should not have height style')
       },
     });
   }), input)
开发者ID:abstask,项目名称:tinymce,代码行数:13,代码来源:IframeNodeTest.ts

示例7:

  }, (rootElement: SugarElement) => {

    Assertions.assertStructure('A basic dialog should have these components',
      ApproxStructure.build((s, str, arr) => {
        return s.element('div', {
          classes: [ arr.has('mce-silver-sink') ],
          children: [
            s.element('div', {
              classes: [ arr.has('tox-dialog-wrap') ],
              children: [
                s.element('div', { classes: [ arr.has('tox-dialog-wrap__backdrop') ] }),
                s.element('div', {
                  classes: [ arr.has('tox-dialog') ],
                  children: [
                    s.element('div', {
                      classes: [ arr.has('tox-dialog__header') ],
                      children: [
                        s.element('div', { classes: [ arr.has('tox-dialog__title') ] }),
                        s.element('div', { classes: [ arr.has('tox-dialog__draghandle') ] }),
                        s.element('button', { classes: [ arr.has('tox-button') ] })
                      ]
                    }),
                    s.element('div', {
                      classes: [ arr.has('tox-dialog__content-js') ],
                      children: [
                        s.element('div', {
                          classes: [ arr.has('tox-dialog__body') ],
                          children: [
                            s.element('div', {
                              // Potentially reinstate once we have the structure 100% defined.
                              // attrs: {
                              //   role: str.is('presentation')
                              // }
                            })
                          ]
                        })
                      ]
                    }),
                    s.element('div', {
                      classes: [ arr.has('tox-dialog__footer') ]
                    })
                  ]
                })
              ]
            })
          ]
        });
      }),
      rootElement
    );
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:51,代码来源:WindowManagerTest.ts

示例8:

 Chain.op((lock) => {
   Assertions.assertStructure(
     'Checking lock has toggled',
     ApproxStructure.build((s, str, arr) => {
       return s.element('button', {
         classes: [
           arr.has('tox-lock'),
           arr.has('tox-button'),
           (locked ? arr.has : arr.not)('tox-locked')]
       });
     }),
     lock
   );
 })
开发者ID:tinymce,项目名称:tinymce,代码行数:14,代码来源:SizeInputTest.ts

示例9:

 Arr.each(nodes, (node) => {
   Assertions.assertEq('Wrapper must be in content', true, editor.getBody().contains(node));
   Assertions.assertStructure(
     'Checking wrapper has correct decoration',
     ApproxStructure.build((s, str, arr) => {
       return s.element('span', {
         attrs: {
           'data-mce-annotation': str.is(name),
           'data-mce-annotation-uid': str.is(uid)
         }
       });
     }),
     SugarElement.fromDom(node)
   );
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:15,代码来源:AnnotationAsserts.ts


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