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


TypeScript FocusTools.sSetActiveValue方法代碼示例

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


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

示例1: TinyApis

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

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Link: should not get anchor info if not selected node', [
        TestLinkUi.sClearHistory,
        tinyApis.sSetContent('<p><a href="http://tinymce.com" class="shouldbekept" title="shouldalsobekept">tiny</a></p>'),
        tinyApis.sSetSelection([0, 0, 0], 2, [0, 0, 0], 2),
        tinyApis.sExecCommand('mcelink'),
        TestLinkUi.sAssertDialogContents({
          href: 'http://tinymce.com',
          text: 'tiny',
          title: 'shouldalsobekept',
          target: ''
        }),
        FocusTools.sSetActiveValue(doc, 'http://something'),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        Waiter.sTryUntil(
          'Wait until link is inserted',
          tinyApis.sAssertContentPresence({
            'a[href="http://something"]': 1,
            'a[class="shouldbekept"]': 1,
            'a[title="shouldalsobekept"]': 1
          }),
          100,
          1000
        ),
        TestLinkUi.sClearHistory
      ]),
      Log.stepsAsStep('TBA', 'Link: should remove attributes if unset in the dialog', [
        TestLinkUi.sClearHistory,
        tinyApis.sSetContent('<p><a href="http://tinymce.com" class="shouldbekept" title="shouldnotbekept">tiny</a></p>'),
        tinyApis.sSetSelection([0, 0, 0], 2, [0, 0, 0], 2),
        tinyApis.sExecCommand('mcelink'),
        TestLinkUi.sAssertDialogContents({
          href: 'http://tinymce.com',
          text: 'tiny',
          title: 'shouldnotbekept',
          target: ''
        }),
        FocusTools.sSetActiveValue(doc, 'http://something'),
        TestLinkUi.sSetInputFieldValue('Title', ''),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        Waiter.sTryUntil(
          'Wait until link is inserted',
          tinyApis.sAssertContentPresence({
            'a[href="http://something"]': 1,
            'a[class="shouldbekept"]': 1,
            'a[title="shouldnotbekept"]': 0
          }),
          100,
          1000
        ),
        TestLinkUi.sClearHistory
      ])
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:58,代碼來源:UpdateLinkTest.ts

示例2: function

const sInsertLink = function (url: string) {
  return Logger.t('Insert link', GeneralSteps.sequence([
    sOpenLinkDialog,
    FocusTools.sSetActiveValue(doc, url),
    sClickSave
  ]));
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:TestLinkUi.ts

示例3: TinyApis

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

    Pipeline.async({}, [
      TestLinkUi.sClearHistory,
      Log.stepsAsStep('TBA', 'Checking only choosing link and submitting works', [
        Step.sync(() => {
          editor.execCommand('mceLink');
        }),
        UiFinder.sWaitForVisible('wait for link dialog', TinyDom.fromDom(document.body), '[role="dialog"]'),
        FocusTools.sTryOnSelector('Selector should be in first field of dialog', doc, '.tox-dialog input'),
        FocusTools.sSetActiveValue(doc, 'http://goo'),
        Chain.asStep(doc, [
          FocusTools.cGetFocused,
          TestLinkUi.cFireEvent('input')
        ]),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        Waiter.sTryUntil(
          'Waiting for link to be inserted',
          tinyApis.sAssertContentPresence({
            'a[href="http://goo"]': 1
          }),
          100,
          1000
        )
      ]),
      TestLinkUi.sClearHistory,
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:30,代碼來源:LinkJustFirstFieldTest.ts

示例4: TinyApis

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

    Pipeline.async({},
      Log.steps('TBA', 'Link: complex selections should preserve the text', [
        TestLinkUi.sClearHistory,
        tinyApis.sSetContent('<p><strong>word</strong></p><p><strong>other</strong></p>'),
        tinyApis.sSetSelection([0], 0, [1], 1),
        tinyApis.sExecCommand('mcelink'),
        UiFinder.sWaitForVisible('wait for link dialog', TinyDom.fromDom(document.body), '[role="dialog"]'),
        FocusTools.sSetActiveValue(doc, 'http://something'),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        Waiter.sTryUntil(
          'Wait until link is inserted',
          tinyApis.sAssertContentPresence({
            'a[href="http://something"]': 2,
            'p:contains(word)': 1,
            'p:contains(other)': 1,
            'p': 2
          }),
          100,
          1000
        ),
        TestLinkUi.sClearHistory
      ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:28,代碼來源:SelectedTextLinkTest.ts

示例5: TinyApis

  TinyLoader.setup((editor, onSuccess, onFailure) => {
    const tinyApis = TinyApis(editor);
    const doc = TinyDom.fromDom(document);

    Pipeline.async({}, [
      TestLinkUi.sClearHistory,
      Log.stepsAsStep('TBA', 'Link: images should be preserved when adding a link', [
        tinyApis.sSetContent('<p><img src="image.png"></p>'),
        tinyApis.sSelect('img', []),
        TestLinkUi.sOpenLinkDialog,
        FocusTools.sSetActiveValue(doc, 'http://something'),
        UiFinder.sNotExists(Body.body(), '.tox-label:contains("Text to display")'),
        TestLinkUi.sClickSave,
        Waiter.sTryUntil(
          'Wait until link is inserted',
          tinyApis.sAssertContentPresence({
            'a[href="http://something"]': 1,
            'img[src="image.png"]': 1,
            'p': 1
          }),
          100,
          1000
        )
      ]),
      Log.stepsAsStep('TBA', 'Link: images should be preserved when editing a link', [
        tinyApis.sSetContent('<p><a href="http://www.google.com/"><img src="image.png"></a></p>'),
        tinyApis.sSelect('a', []),
        TestLinkUi.sOpenLinkDialog,
        FocusTools.sSetActiveValue(doc, 'http://something'),
        UiFinder.sNotExists(Body.body(), '.tox-label:contains("Text to display")'),
        TestLinkUi.sClickSave,
        Waiter.sTryUntil(
          'Wait until link is updated',
          tinyApis.sAssertContentPresence({
            'a[href="http://something"]': 1,
            'img[src="image.png"]': 1,
            'p': 1
          }),
          100,
          1000
        )
      ]),
      TestLinkUi.sClearHistory
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:45,代碼來源:SelectedImageLinkTest.ts

示例6: 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

示例7: TinyApis

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

    Pipeline.async({},
      Log.steps('TBA', 'Charmap: Open dialog, Search for "euro", Euro should be first option', [
        tinyApis.sFocus,
        tinyUi.sClickOnToolbar('click charmap', 'button[aria-label="Special character"]'),
        Chain.asStep({}, [
          tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
        ]),
        FocusTools.sTryOnSelector('Focus should start on', doc, '[role="tab"]'), // TODO: Remove duped startup of these tests
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sTryOnSelector('Focus should have moved to input', doc, 'input'),
        FocusTools.sSetActiveValue(doc, 'euro'),
        Chain.asStep(doc, [
          FocusTools.cGetFocused,
          cFakeEvent('input')
        ]),
        Waiter.sTryUntil(
          'Wait until Euro is the first choice (search should filter)',
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('.tox-collection__item:first'),
            Chain.mapper((item) => {
              return Attr.get(item, 'data-collection-item-value');
            }),
            Assertions.cAssertEq('Search should show euro', '€')
          ]),
          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>&euro;</p>'),
          100,
          1000
        )
      ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:44,代碼來源:CharmapSearchTest.ts

示例8:

    const testNoProtocolConfirm = (url) => {
      const presence = {};
      presence[`a[href="${url}"]:contains("Something")`] = 1;

      return GeneralSteps.sequence([
        tinyApis.sSetContent('<p>Something</p>'),
        tinyApis.sSetSelection([ 0, 0 ], ''.length, [ 0, 0 ], 'Something'.length),
        TestLinkUi.sOpenLinkDialog,

        FocusTools.sSetActiveValue(doc, url),
        TestLinkUi.sAssertDialogContents({
          href: url,
          text: 'Something',
          title: '',
          target: ''
        }),
        TestLinkUi.sClickSave,
        UiFinder.sNotExists(TinyDom.fromDom(document.body), '[role="dialog"]'),
        TestLinkUi.sAssertContentPresence(tinyApis, presence)
      ]);
    };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:21,代碼來源:UrlProtocolTest.ts

示例9: TinyApis

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

    Pipeline.async({},
      Log.steps('TBA', 'Charmap: User defined charmap', [
        tinyApis.sFocus,
        tinyApis.sFocus,
        tinyUi.sClickOnToolbar('click charmap', 'button[aria-label="Special character"]'),
        tinyUi.sWaitForPopup('wait for popup', 'div[role="dialog"]'),
        FocusTools.sTryOnSelector('Focus should have moved to input', doc, 'input'),
        FocusTools.sSetActiveValue(doc, 'A'),
        Chain.asStep(doc, [
          FocusTools.cGetFocused,
          cFakeEvent('input')
        ]),
        tinyUi.sWaitForUi('wait for character A', '.tox-collection .tox-collection__item-icon:contains(A)')
      ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:21,代碼來源:CharmapUserDefinedTest.ts

示例10: sInitialState

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const doc = Element.fromDom(document);
    Pipeline.async({},
      Log.steps('TBA', 'FullPage: Test initial data, set new input values, open dialog, verify that the dialog data matches the input values', [

        sInitialState(editor),
        sCheckInputValue('Title', selectors.titleInput, 'Fullpage Dialog Test Title'),
        sCheckInputValue('Keywords', selectors.keywordsInput, ''),
        sCheckInputValue('Description', selectors.descriptionInput, ''),
        sCheckInputValue('Robots', selectors.robotsInput, ''),
        sCheckInputValue('Author', selectors.authorInput, ''),
        sCheckInputValue('Encoding', selectors.encodingInput, 'ISO-8859-1'),

        FocusTools.sTryOnSelector(
          'Focus should start on first input',
          doc,
          selectors.titleInput
        ),
        FocusTools.sSetActiveValue(doc, 'the nu title'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sSetActiveValue(doc, 'the nu keywords'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sSetActiveValue(doc, 'the nu description'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sSetActiveValue(doc, 'the nu robots'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sSetActiveValue(doc, 'the nu author'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sSetActiveValue(doc, 'the nu encoding'),
        FocusTools.sIsOnSelector('last', doc, selectors.encodingInput),

        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sIsOnSelector('The cancel button should be focused', doc, 'button:contains("Cancel")'),
        Keyboard.sKeydown(doc, Keys.tab(), { }),
        FocusTools.sIsOnSelector('The save button should be focused', doc, 'button:contains("Save")'),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        UiFinder.sNotExists(Body.body(), 'div.tox-dialog'),

        sOpenDialog(editor),
        sCheckInputValue('Title', selectors.titleInput, 'the nu title'),
        sCheckInputValue('Keywords', selectors.keywordsInput, 'the nu keywords'),
        sCheckInputValue('Description', selectors.descriptionInput, 'the nu description'),
        sCheckInputValue('Robots', selectors.robotsInput, 'the nu robots'),
        sCheckInputValue('Author', selectors.authorInput, 'the nu author'),
        sCheckInputValue('Encoding', selectors.encodingInput, 'the nu encoding'),
    ]), onSuccess, onFailure);

  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:48,代碼來源:FullPageDialogPluginTest.ts


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