當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。