Ejemplo n.º 1
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      Logger.t('Should should retain open attribute if it is not opened', GeneralSteps.sequence([
        tinyApis.sSetContent('<details><summary>a</summary>b</details>'),
        tinyApis.sAssertContentStructure(ApproxStructure.build((s, str, arr) => {
          return s.element('body', {
            children: [
              s.element('details', {
                attrs: {
                  'open': str.is('open'),
                  'data-mce-open': str.none('Should not have a data attr')
                },
                children: [
                  s.element('summary', {
                    children: [
                      s.text(str.is('a'))
                    ]
                  }),
                  s.text(str.is('b'))
                ]
              })
            ]
          });
        })),
        tinyApis.sAssertContent('<details><summary>a</summary>b</details>')
      ])),
      Logger.t('Should should retain open attribute if it opened', GeneralSteps.sequence([
        tinyApis.sSetContent('<details open="open"><summary>a</summary>b</details>'),
        tinyApis.sAssertContentStructure(ApproxStructure.build((s, str, arr) => {
          return s.element('body', {
            children: [
              s.element('details', {
                attrs: {
                  'open': str.is('open'),
                  'data-mce-open': str.is('open')
                },
                children: [
                  s.element('summary', {
                    children: [
                      s.text(str.is('a'))
                    ]
                  }),
                  s.text(str.is('b'))
                ]
              })
            ]
          });
        })),
        tinyApis.sAssertContent('<details open="open"><summary>a</summary>b</details>')
      ]))
    ], onSuccess, onFailure);
  }, {
Ejemplo n.º 2
0
  TinyLoader.setup((editor: Editor, onSuccess, onFailure) => {
      const uiContainer = Element.fromDom(editor.getContainer());
      const contentAreaContainer = Element.fromDom(editor.getContentAreaContainer());

      const tinyApis = TinyApis(editor);

      Pipeline.async({ }, Arr.flatten([
        sUiContainerTest(editor, uiContainer, tinyApis),
        sContentAreaContainerTest(contentAreaContainer)
      ]), onSuccess, onFailure);
    },
Ejemplo n.º 3
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      sTestEnterAtStartOfAnchorZwsp(tinyApis, tinyActions),
      sTestEnterAtEndOfAnchorZwsp(tinyApis, tinyActions),
      sTestEnterAtStartOfAnchorZwspWithAdjacentContent(tinyApis, tinyActions),
      sTestEnterAtEndOfAnchorZwspWithAdjacentContent(tinyApis, tinyActions)
    ], onSuccess, onFailure);
  }, {
Ejemplo n.º 4
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      Logger.t('Select image by context menu clicking on it', GeneralSteps.sequence([
        Step.label('Focus editor', tinyApis.sFocus),
        Step.label('Set editor content to a paragraph with a image within', tinyApis.sSetContent('<p><img src="http://www.google.com/google.jpg" width="100" height="100"></p>')),
        Step.label('Context menu click on the image', sContextMenuClickInMiddleOf(editor, [0, 0])),
        Step.label('Check that the image is selected', tinyApis.sAssertSelection([0], 0, [0], 1))
      ]))
    ], onSuccess, onFailure);
  }, {
Ejemplo n.º 5
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor), tinyActions = TinyActions(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      sBoldTests(tinyApis),
      sH2Tests(tinyApis),
      sLinkTests(tinyApis, tinyActions),
      sInsertTableTests(editor, tinyApis),
      sAriaTests(tinyApis, tinyActions)
    ], onSuccess, onFailure);
  }, {
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      Logger.t('Select image by context menu clicking on it', GeneralSteps.sequence([
        tinyApis.sFocus,
        tinyApis.sSetContent('<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==" width="100" height="100"></p>'),
        sContextMenuClickInMiddleOf(editor, [0, 0]),
        tinyApis.sAssertSelection([0], 0, [0], 1)
      ]))
    ], onSuccess, onFailure);
  }, {
Ejemplo n.º 7
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Table: test that settings for appearance can be disabled', [
        tinyApis.sFocus,
        tinyApis.sSetContent(tableHtml),
        // This used to be opening the context toolbar.
        tinyApis.sSelect('table td', [0]),
        tinyApis.sExecCommand('mceTableProps'),
        Chain.asStep({}, [
          TableTestUtils.cWaitForDialog,
          Chain.op(function (dialog) {
            Assertions.assertPresence(
              'assert presence of spacing, padding, border and caption inputs',
              {
                // Remove the label:0 when it is working.
                'label:contains("Cell spacing")': 0,
                'label:contains("Cell padding")': 0,
                'label:contains("Border") + input': 0,
                'label:contains("Caption")': 0
              }, dialog);
          })
        ]),
        TableTestUtils.sClickDialogButton('close', false)
      ]),

      Log.stepsAsStep('TBA', 'Table: test that settings for appearance can be enabled', [
        tinyApis.sSetSetting('table_appearance_options', true),
        tinyApis.sFocus,
        tinyApis.sSetContent(tableHtml),
        // This used to be opening the context toolbar.
        tinyApis.sSelect('table td', [0]),
        tinyApis.sExecCommand('mceTableProps'),
        Chain.asStep({}, [
          TableTestUtils.cWaitForDialog,
          Chain.op(function (dialog) {
            Assertions.assertPresence(
              'assert presence of spacing, padding, border and caption inputs',
              {
                // Remove the label:0 when it is working.
                'label:contains("Cell spacing")': 1,
                'label:contains("Cell padding")': 1,
                'label:contains("Border") + input': 1,
                'label:contains("Caption")': 1
              }, dialog);
          })
        ]),
        TableTestUtils.sClickDialogButton('close', false)
      ])
    ], onSuccess, onFailure);
  }, {
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      Logger.t('get text format content should trim zwsp', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>' + Zwsp.ZWSP + 'a</p>'),
        Step.sync(function () {
          const html = editor.getContent({ format: 'text' });
          Assertions.assertEq('Should be expected html', 'a', html);
        })
      ]))
    ], onSuccess, onFailure);
  }, {
Ejemplo n.º 9
0
  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({},
      Log.steps('TBA', 'Preview: Set content, set style setting and assert content and style. Delete style and assert style is removed', [
        tinyApis.sSetContent('<p>hello world</p>'),
        tinyApis.sSetSetting('content_style', 'p {color: blue;}'),
        sAssertIframeHtmlContains(editor, '<style type="text/css">p {color: blue;}</style>'),
        tinyApis.sDeleteSetting('content_style'),
        sAssertIframeHtmlNotContains(editor, '<style type="text/css">p {color: blue;}</style>')
    ])
    , onSuccess, onFailure);
  }, {
  TinyLoader.setup(function (editor: Editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, Env.gecko ? [ // This test is only relevant on Firefox
      Logger.t('cursor before table type', GeneralSteps.sequence([
        tinyApis.sSetContent('<table style="border-collapse: collapse; width: 100%;" border="1"><tbody><tr><td style="width: 50%;">&nbsp;</td><td style="width: 50%;">&nbsp;</td></tr><tr><td style="width: 50%;">&nbsp;</td><td style="width: 50%;">&nbsp;</td></tr></tbody></table>'),
        tinyApis.sSetCursor([], 0),
        sAssertUndoManagerDataLength(editor, 1),
        Step.sync(() => KeyUtils.type(editor, 'a')),
        sAssertUndoManagerDataLength(editor, 3)
      ]))
    ] : [], onSuccess, onFailure);
  }, {