本文整理汇总了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);
}, {
示例2: function
const sInsertLink = function (url: string) {
return Logger.t('Insert link', GeneralSteps.sequence([
sOpenLinkDialog,
FocusTools.sSetActiveValue(doc, url),
sClickSave
]));
};
示例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);
}, {
示例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);
}, {
示例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);
}, {
示例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);
}, {
示例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>€</p>'),
100,
1000
)
])
, onSuccess, onFailure);
}, {
示例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)
]);
};
示例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);
}, {
示例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);
}, {