本文整理匯總了TypeScript中tinymce/themes/mobile/ui/IosRealm.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
//.........這裏部分代碼省略.........
const sTestNavigation = GeneralSteps.sequence([
Keyboard.sKeydown(doc, Keys.tab(), { }),
sAssertTextFocused,
Keyboard.sKeydown(doc, Keys.tab(), { }),
sAssertTitleFocused,
Keyboard.sKeydown(doc, Keys.tab(), { }),
sAssertTargetFocused,
Keyboard.sKeydown(doc, Keys.tab(), { shift: true }),
sAssertTitleFocused,
Keyboard.sKeydown(doc, Keys.tab(), { shift: false }),
sAssertTargetFocused,
Keyboard.sKeydown(doc, Keys.tab(), { }),
Step.wait(1000),
Logger.t('Checking pressing tab at the end should not move focus', sAssertTargetFocused),
sClickPrev,
sAssertTitleFocused,
sClickNext,
sAssertTargetFocused,
sClickPrev,
sAssertTitleFocused,
sClickPrev,
sAssertTextFocused,
sClickPrev,
sAssertUrlFocused
]);
const sClickLink = Mouse.sClickOn(realm.element(), TestSelectors.link());
const sTestScenario = function (rawScenario) {
const scenario = ValueSchema.asRawOrDie('Checking scenario', ValueSchema.objOf([
FieldSchema.strict('label'),
FieldSchema.defaulted('content', ''),
FieldSchema.defaulted('node', Element.fromText('')),
FieldSchema.strictObjOf('fields', [
FieldSchema.option('url'),
FieldSchema.option('text'),
FieldSchema.option('title'),
FieldSchema.option('target')
]),
FieldSchema.strict('expected'),
FieldSchema.defaulted('beforeExecute', Step.pass),
FieldSchema.defaulted('mutations', Fun.constant(Step.pass))
]), rawScenario);
return Logger.t(
scenario.label,
GeneralSteps.sequence([
tEditor.sPrepareState(scenario.node.dom(), scenario.content),
sClickLink,
TestUi.sSetFieldOptValue(scenario.fields.url),
sClickNext,
sAssertTextFocused,
TestUi.sSetFieldOptValue(scenario.fields.text),
sClickNext,
sAssertTitleFocused,
TestUi.sSetFieldOptValue(scenario.fields.title),
sClickNext,
sAssertTargetFocused,
TestUi.sSetFieldOptValue(scenario.fields.target),
sClickPrev,
sAssertTitleFocused,
sClickPrev,
sAssertTextFocused,
sClickPrev,
示例2: function
UnitTest.asynctest('Browser Test: ios.IosRealmTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
const detection = PlatformDetection.detect();
const realm = IosRealm(Fun.noop);
const unload = function () {
Remove.remove(iframe);
Attachment.detachSystem(realm.system());
};
const iframe = Element.fromTag('iframe');
Css.set(iframe, 'height', '400px');
const onload = DomEvent.bind(iframe, 'load', function () {
const head = Element.fromDom(iframe.dom().contentWindow.document.head);
const body = Element.fromDom(iframe.dom().contentWindow.document.body);
Attachment.attachSystem(body, realm.system());
Css.set(body, 'margin', '0px');
const css = Element.fromTag('link');
Attr.setAll(css, {
href: '/project/tinymce/js/tinymce/skins/ui/oxide/skin.mobile.min.css',
rel: 'Stylesheet',
type: 'text/css'
});
Insert.append(head, css);
onload.unbind();
const editor = Element.fromTag('iframe');
Attr.set(editor, 'src', '/project/tinymce/src/themes/mobile/test/html/editor.html');
Replacing.append(
realm.system().getByDom(Element.fromDom(
realm.element().dom().querySelector('.tinymce-mobile-editor-socket'))
).getOrDie(),
GuiFactory.external({
element: editor
})
);
realm.init({
editor: {
getFrame () {
return editor;
},
onDomChanged () {
return { unbind: Fun.noop };
}
},
container: realm.element(),
socket: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-editor-socket')),
toolstrip: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-toolstrip')),
toolbar: Element.fromDom(realm.element().dom().querySelector('.tinymce-mobile-toolbar')),
alloy: realm.system(),
dropup: realm.dropup()
});
});
Insert.append(Body.body(), iframe);
const getCursorY = function (target) {
/* The y position on the cursor for the viewer is a combination of y position of the editor frame and the y
* y position of the target
*/
const editorY = iframe.dom().contentWindow.document.querySelector('iframe').getBoundingClientRect().top;
const targetY = target.dom().getBoundingClientRect().top;
// tslint:disable-next-line:no-console
console.log('editorY', editorY, 'targetY', targetY);
return editorY + targetY;
};
const mShowKeyboard = function (selector, index) {
const keyboardHeight = 200;
return Step.stateful(function (value, next, die) {
const pageBody = iframe.dom().contentWindow.document.body;
const editorBody = pageBody.querySelector('iframe').contentWindow.document.body;
const target: any = Option.from(editorBody.querySelectorAll(selector)[index]).map(Element.fromDom).getOrDie('no index ' + index + ' for selector: ' + selector);
WindowSelection.setExact(editorBody.ownerDocument.defaultView, target, 0, target, 0);
const socket = pageBody.querySelector('.tinymce-mobile-editor-socket');
socket.scrollTop = target.dom().getBoundingClientRect().top - 100 - keyboardHeight;
pageBody.style.setProperty('margin-bottom', '2000px');
pageBody.ownerDocument.defaultView.scrollTo(0, keyboardHeight);
//
const cursorY = getCursorY(target);
const newValue = Merger.deepMerge(
value,
{
target,
cursorY
}
);
// tslint:disable-next-line:no-console
console.log('newValue', newValue);
next(newValue);
});
};
Pipeline.async({}, detection.browser.isChrome() ? [
//.........這裏部分代碼省略.........
示例3: function
UnitTest.asynctest('Browser Test: ui.FontSizeSliderTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
const detection = PlatformDetection.detect();
const realm = IosRealm(Fun.noop);
// Make toolbar appear
Class.add(realm.system().element(), 'tinymce-mobile-fullscreen-maximized');
const body = Body.body();
Attachment.attachSystem(body, realm.system());
TestStyles.addStyles();
const unload = function () {
TestStyles.removeStyles();
Attachment.detachSystem(realm.system());
};
const tEditor = TestFrameEditor();
realm.system().add(tEditor.component());
realm.setToolbarGroups([
{
label: 'group1',
items: [
FontSizeSlider.sketch(realm, tEditor.editor())
]
}
]);
Pipeline.async({}, detection.browser.isChrome() ? [
TestStyles.sWaitForToolstrip(realm),
tEditor.sWaitForEditorLoaded,
Step.sync(function () {
tEditor.editor().focus();
}),
Mouse.sClickOn(realm.system().element(), TestSelectors.fontsize()),
tEditor.sAssertEq('on first showing, the font size slider should not have fired execCommand', [ ])
// Think about how to do the slider events
] : [], function () {
unload(); success();
}, failure);
});
示例4: function
UnitTest.asynctest('Browser Test: ui.ButtonsTest', function (success, failure) {
/*
* PURPOSE
*
* There are three buttons. Two have toggling, and one toggling button has a custom action.
* Ensure that they all fire the right actions and get updated appropriately based on broadcasts.
*/
const realm = IosRealm(Fun.noop);
const body = Body.body();
Attachment.attachSystem(body, realm.system());
// Make toolbar appear
Class.add(realm.system().element(), 'tinymce-mobile-fullscreen-maximized');
const doc = Traverse.owner(body);
TestStyles.addStyles();
const unload = function () {
TestStyles.removeStyles();
Attachment.detachSystem(realm.system());
};
/* The test editor puts execCommand and insertContent calls into the store */
const tEditor = TestEditor();
const memAlpha = Memento.record(
Buttons.forToolbarCommand(tEditor.editor(), 'alpha')
);
const memBeta = Memento.record(
Buttons.forToolbarStateCommand(tEditor.editor(), 'beta')
);
const memGamma = Memento.record(
Buttons.forToolbarStateAction(tEditor.editor(), 'gamma-class', 'gamma-query', function () {
tEditor.adder('gamma-action')();
})
);
const sClickAlpha = TestUi.sClickComponent(realm, memAlpha);
const sClickBeta = TestUi.sClickComponent(realm, memBeta);
const sClickGamma = TestUi.sClickComponent(realm, memGamma);
const sCheckComponent = function (label, state) {
return function (memento) {
return TestUi.sWaitForToggledState(label, state, realm, memento);
};
};
realm.setToolbarGroups([
{
label: 'group1',
items: [
memAlpha.asSpec(),
memBeta.asSpec(),
memGamma.asSpec()
]
}
]);
/*
* Alpha has no toggling, so just check that when the user clicks on the button, the
* editor fires execCommand with alpha
*/
const sTestAlpha = GeneralSteps.sequence([
tEditor.sAssertEq('Initially empty', [ ]),
sClickAlpha,
tEditor.sAssertEq('After clicking on alpha', [
{
method: 'execCommand',
data: {
alpha: undefined
}
}
]),
tEditor.sClear
]);
/*
* Beta has toggling, so check:
* - when the user clicks on the button, execCommand is fired
* - when the format change is broadcast, the toggled state changes
*/
const sTestBeta = GeneralSteps.sequence([
tEditor.sAssertEq('before beta, store is empty', [ ]),
sClickBeta,
tEditor.sAssertEq('After clicking on beta', [
{
method: 'execCommand',
data: {
beta: undefined
}
}
]),
tEditor.sClear,
sCheckComponent('Initially, beta should be unselected', false)(memBeta),
//.........這裏部分代碼省略.........